Code for Female contraception and male castration increase lifespan across vertebrates

Supplmentary Information

Author

Michael Garratt, Malgorzata Lagisz, Johanna Stärk, Christine Neyt, Michael Stout, José V. V. Isola, Veronica Cowl, Nannette Driver-Ruiz, Ashley D. Franklin, Monica M. McDonald, David Powell, Susan L. Walker, Jean-Michel Gaillard, Dalia A. Conde, Jean-François Lemaître, Fernando Colchero and Shinichi Nakagawa

Published

May 6, 2025

1 Setting-up

1.1 Loading packages

Code
# packages ####

#ochaRd
# 
# install.packages("devtools")
# install.packages("tidyverse")
# #install.packages("metafor")
# install.packages("patchwork")
# install.packages("R.rsp")
# 
# devtools::install_github("daniel1noble/orchaRd", force = TRUE, build_vignettes = TRUE)
# remotes::install_github("rvlenth/emmeans", dependencies = TRUE, build_opts = "") 
# 
# #emmeans
# remotes::install_github("rvlenth/emmeans", dependencies = TRUE, build_opts = "")
# # metafor
# install.packages("remotes")
# remotes::install_github("wviechtb/metafor")

# loading
pacman::p_load(tidyverse,
               metafor,
               pander,
               stringr,
               ape,
               kableExtra,
               patchwork,
               lme4,
               readxl,
               emmeans,
               rotl,
               orchaRd,
               clubSandwich,
               MuMIn,
               png,
               grid,
               here,
               formatR,
               naniar,
               GoodmanKruskal,
               ggalluvial,
               ggplot2,
               cowplot,
               apextra,
               ggimage,
               ggstance,
               ggtree,
               apextra,
               phytools
)

# need for metafor to understand MuMin 
eval(metafor:::.MuMIn)

1.2 Loading custom functions

Code
# custom functions 

# function for getting lnRR for proportional data (mortality)
# older version
# lnrrp <- function(m1, m2, n1, n2) {
#   # arcsine transforamtion
#   asin_trans <- function(p) { asin(sqrt(p)) }
#   # SD for arcsine distribution (see Wiki - https://en.wikipedia.org/wiki/Arcsine_distribution)
#   var1 <- 1/8
#   var2 <- 1/8
#   # lnRR - with 2nd order correction
#   lnrr <- log(asin_trans(m1)/asin_trans(m2)) + 
#     0.5 * ((var1 / (n1 * asin_trans(m1)^2)) - (var2 / (n2 * asin_trans(m2)^2)))   
#   
#   var <- var1 / (n1 * asin_trans(m1)^2) + var1^2 / (2 * n1^2 * asin_trans(m1)^4)  + 
#     var2 / (n2 * asin_trans(m2)^2) + var2^2 / (2 * n2^2 * asin_trans(m2)^4) 
#   
#   invisible(data.frame(yi = lnrr , vi = var))
# }

lnrrp <- function(m1, m2, n1, n2) {
  # if p1 or p2 = 0, turn into 0.025, if p1 or p2 = 1, turn into 0.975
    m1[m1 == 0] <- 0.025
    m1[m1 == 1] <- 0.975
    m2[m2 == 0] <- 0.025
    m2[m2 == 1] <- 0.975
  # arcsine transforamtion
  asin_trans <- function(p) { asin(sqrt(p)) }
  # SD for arcsine distribution (see Wiki - https://en.wikipedia.org/wiki/Arcsine_distribution)
  var1 <- 1/8
  var2 <- 1/8
  # lnRR - with 2nd order correction
  lnrr <- log(asin_trans(m1)/asin_trans(m2)) + 
    0.5 * ((var1 / (n1 * asin_trans(m1)^2)) - (var2 / (n2 * asin_trans(m2)^2))) 
  
  var <- var1 / (n1 * asin_trans(m1)^2) + var1^2 / (2 * n1^2 * asin_trans(m1)^4)  + 
    var2 / (n2 * asin_trans(m2)^2) + var2^2 / (2 * n2^2 * asin_trans(m2)^4) 
  
  invisible(data.frame(yi = lnrr , vi = var))
}


# function to get to lnRR for longevity data (CV required)
# The method proposed in Nakagawa et al (2022) - missing SD method

lnrrm <- function(m1, m2, n1, n2, cv21, cv22) {
  # lnRR - with 2nd order correction
  lnrr <- log(m1/m2) + 
    0.5 * ((cv21 /n1) - (cv22 / n2))    
  
  var <- (cv21 / n1) + ((cv21^2) / (2 * n1^2))  + 
    (cv22/ n2) + ((cv22^2) / (2 * n2^2) )
  
  invisible(data.frame(yi = lnrr , vi = var))
}

# for folded normal distribution see: https://en.wikipedia.org/wiki/Folded_normal_distribution

# folded mean
folded_mu <-function(mean, variance){
  mu <- mean
  sigma <- sqrt(variance)
  fold_mu <- sigma*sqrt(2/pi)*exp((-mu^2)/(2*sigma^2)) + mu*(1 - 2*pnorm(-mu/sigma))
  fold_mu
} 

# folded variance
folded_v <-function(mean, variance){
  mu <- mean
  sigma <- sqrt(variance)
  fold_mu <- sigma*sqrt(2/pi)*exp((-mu^2)/(2*sigma^2)) + mu*(1 - 2*pnorm(-mu/sigma))
  fold_se <- sqrt(mu^2 + sigma^2 - fold_mu^2)
  # adding se to make bigger mean
  fold_v <-fold_se^2
  fold_v
} 


# log response ratio for plotting (replacing just missing data)
# not using CV for drawing the plot
lnrrm2 <- function(m1, m2, n1, n2, sd1, sd2) {
  # lnRR - with 2nd order correction
  cv21 <- (sd1/m1)^2
  cv22 <- (sd2/m2)^2
  
  lnrr <- log(m1/m2) + 
    0.5 * ((cv21 /n1) - (cv22 / n2))    
  
  var <- (cv21 / n1) + ((cv21^2) / (2 * n1^2))  + 
    (cv22/ n2) + ((cv22^2) / (2 * n2^2) )
  
  invisible(data.frame(yi = lnrr , vi = var))
}


# turning survival % into life expectancy
# note that if m1 = treatment lives 100% (happens twice in the data then we use the height observed in the data-set)

lnrre <- function(m1, m2, n1, n2) {
  
  # expected life span transformation
  
  ea1 <- -1/log(m1)
  ea2 <- -1/log(m2)    
  # var using the delta method
  # V is not var like above - it is not sampling SD but error
  V1 <- ((1-m1)*m1/n1)*(1/(m1*log(m1)^2))^2
  V2 <- ((1-m2)*m2/n2)*(1/(m2*log(m2)^2))^2
  
  lnrr <- log(ea1/ea2)
  
  var <- V1 + V2

  
  invisible(data.frame(yi = lnrr , vi = var))
}


#' Title: Contrast name generator
#'
#' @param name: a vector of character strings
cont_gen <- function(name) {
  combination <- combn(name, 2)
  name_dat <- t(combination)
  names <- paste(name_dat[, 1], name_dat[, 2], sep = "-")
  return(names)
}

#' @title get_pred1: intercept-less model
#' @description Function to get CIs (confidence intervals) and PIs (prediction intervals) from rma objects (metafor)
#' @param model: rma.mv object 
#' @param mod: the name of a moderator 
get_pred1 <- function (model, mod = " ") {
  name <- firstup(as.character(stringr::str_replace(row.names(model$beta), mod, "")))
  len <- length(name)
  
   if (len != 1) {
        newdata <- diag(len)
        pred <- metafor::predict.rma(model, 
                                     newmods = newdata,
                                     tau2.levels = 1:len)
    }
    else {
        pred <- metafor::predict.rma(model)
  }
  estimate <- pred$pred
  lowerCL <- pred$ci.lb
  upperCL <- pred$ci.ub 
  lowerPR <- pred$cr.lb
  upperPR <- pred$cr.ub 
  
  table <- tibble(name = factor(name, levels = name, labels = name), estimate = estimate,
                  lowerCL = lowerCL, upperCL = upperCL,
                  pval = model$pval,
                  lowerPR = lowerPR, upperPR = upperPR)
}

#' @title get_pred2: normal model
#' @description Function to get CIs (confidence intervals) and PIs (prediction intervals) from rma objects (metafor)
#' @param model: rma.mv object 
#' @param mod: the name of a moderator 
get_pred2 <- function (model, mod = " ") {
  name <- as.factor(str_replace(row.names(model$beta), 
                                paste0("relevel", "\\(", mod,", ref = name","\\)"),""))
  len <- length(name)
  
  if(len != 1){
  newdata <- diag(len)
  pred <- predict.rma(model, intercept = FALSE, newmods = newdata[ ,-1])
  }
  else {
    pred <- predict.rma(model)
  }
  estimate <- pred$pred
  lowerCL <- pred$ci.lb
  upperCL <- pred$ci.ub 
  lowerPR <- pred$cr.lb
  upperPR <- pred$cr.ub 
  
  table <- tibble(name = factor(name, levels = name, labels = name), estimate = estimate,
                  lowerCL = lowerCL, upperCL = upperCL,
                  pval = model$pval,
                  lowerPR = lowerPR, upperPR = upperPR)
}

#' @title mr_results
#' @description Function to put results of meta-regression and its contrasts
#' @param res1: data frame 1
#' @param res1: data frame 2
mr_results <- function(res1, res2) {
  restuls <-tibble(
    `Fixed effect` = c(as.character(res1$name), cont_gen(res1$name)),
    Estimate = c(res1$estimate, res2$estimate),
    `Lower CI [0.025]` = c(res1$lowerCL, res2$lowerCL),
    `Upper CI  [0.975]` = c(res1$upperCL, res2$upperCL),
    `P value` = c(res1$pval, res2$pval),
    `Lower PI [0.025]` = c(res1$lowerPR, res2$lowerPR),
    `Upper PI  [0.975]` = c(res1$upperPR, res2$upperPR),
  )
}


#' @title all_models
#' @description Function to take all possible models and get their results
#' @param model: intercept-less model
#' @param mod: the name of a moderator 

all_models <- function(model, mod = " ", type = "homo") {
  
  # getting the level names out
  level_names <- levels(factor(model$data[[mod]]))
  dat2 <- model$data
  mod <- mod


  run_rma1 <- function(name) {
      VCV1 <- vcalc(vi = dat2$vi,
             cluster = dat2$species,
             obs = dat2$obs_id,
             rho = 0.5)
      
    rma.mv(yi, V = VCV1,
                   mods = ~relevel(dat2[[mod]], ref = name),
                     random = list(
                       ~1|species,
                       ~1|phylogeny,
                       ~1|obs_id),
                     R = list(phylogeny = cor_tree),
                     data = dat2,
                     control = list(optimizer = "Nelder-Mead"))
   }

    run_rma2 <- function(name) {
    
            VCVa <- vcalc(vi = dat2$abs_vi, 
                          species,
                          obs = obs_id,
                    rho = 0.5, data = dat2)
               
               rma.mv(abs_yi, V = VCVa,
               mods = ~relevel(dat2[[mod]], ref = name),
                     random = list(
                       ~1|species,
                       ~1|phylogeny,
                       ~1|obs_id),
                     R = list(phylogeny = cor_tree),
                     data = dat2,
                     control = list(optimizer = "Nelder-Mead"))
   }

# results of meta-regression including all contrast results; taking the last level out ([-length(level_names)])
# this does not work for hetero model?
if (type == "homo"){

    model_all <- purrr::map(level_names[-length(level_names)], run_rma1)

  } else {
  model_all <- purrr::map(level_names[-length(level_names)], run_rma2)
  }
  
  # getting estimates from intercept-less models (means for all the groups)
  res1 <- get_pred1(model, mod = mod)
  
  # getting estiamtes from all contrast models
  res2_pre <- purrr::map(model_all, ~ get_pred2(.x, mod = mod))
  
  # a list of the numbers to take out unnecessary contrasts
  contra_list <- Map(seq, from=1, to=1:(length(level_names) - 1))
  res2 <- purrr::map2_dfr(res2_pre, contra_list, ~.x[-(.y), ]) 
  # creating a table
  res_tab <- mr_results(res1, res2) %>% 
  kable("html",  digits = 3) %>%
  kable_styling("striped", position = "left") %>%
  scroll_box(width = "100%")
  
  # results
  res_tab

}

2 PART I: LIFESPAN ANALYSIS ON LITERAURE DATA

3 Data preparation & processing

Code
#dat_full <- read_csv(here("data", "dat_07072021.csv"), na = c("", "NA")) 
#dat_full <- read_csv(here("data", "data_15022022.csv"), na = c("", "NA"))
dat_full <- read_csv(here("data", "literature", "data_05052022.csv"), na = c("", "NA"))
#glimpse(dat_full)

#loading data ####

dat_full %>% filter(is.na(Treatment_lifespan_variable) == FALSE) %>% 
  filter(Type_of_sterilization != "Vasectomy") %>% 
  mutate_if(is.character, as.factor) -> dat


#dim(dat)
#dim(dat_full)
# separating two kinds

effect_type <- ifelse(str_detect(dat$Lifespan_parameter, "Me"), "longevity", "mortality")

# splitting longevity into two types where they have SD or not
effect_type2 <- ifelse(str_detect(dat$Lifespan_parameter, "Me") & is.na(dat$Error_control_SD), "missing", effect_type)

#fix a typo in species name
dat$Species_Latin <- gsub("Macaca Fascicularis", "Macaca fascicularis", dat$Species_Latin) 
dat$Species_Latin <- gsub("Equus caballus", "Equus ferus", dat$Species_Latin)

# creating the phylo column
dat$Phylogeny <- sub(" ", "_",  dat$Species_Latin)
dat$Effect_type <- effect_type
dat$Effect_ID <- 1:nrow(dat)
# key variables
#names(dat)
#unique(dat$Species_Latin)

kable(dat, "html") %>% 
  kable_styling("striped", position = "left") %>% 
  scroll_box(width = "100%", 
    height = "250px")
Order_extracted Study Controlled_treatments Type_of_sterilization Gonads_removed Control_treatment Shamtreatment_moderator Sex Species_Latin Species Strain Environment Wild_or_semi_wild Age_at_treatment Maturity_at_treatment Maturity_at_treatment_ordinal Duration_of_treatment Shared_control Control_lifespan_variable Treatment_lifespan_variable Opposite_sex_lifespan_variable Error_control Error_experimental Error_opposite_sex Lifespan_parameter Lifespan_unit Error_unit Error_control_SD Error_experimental_SD Error_opposite_sex_SD Coefficent_difference_to_control Lower_interval Upper_interval Coefficent_unit Sample_size_control Sample_size_sterilization Sample_size_opposite_sex Notes Notes2 Notes3 Phylogeny Effect_type Effect_ID
1 Kirkpatrick and Turner 2004 No porcine zona pellucida (PZP) immunocontraception No untreated No Female Equus ferus Horses NA Wild Yes 2 Years Adult 4 Less than 3 years 1 6.4700 10.2700 10.300 0.850 0.5600 0.840 Mean years S.E.M 5.508630 1.857310 6.285984 NA NA NA NA 42 11 56 Sterilization requires booster injections and these did not receive, the longer treatment did NA NA Equus_ferus longevity 1
2 Kirkpatrick and Turner 2004 No porcine zona pellucida (PZP) immunocontraception No untreated No Female Equus ferus Horses NA Wild Yes 2 Years Adult 4 More than 3 years 1 6.4700 19.9400 10.300 0.850 1.6600 0.840 Mean years S.E.M 5.508630 7.235772 6.285984 NA NA NA NA 42 19 56 NA NA NA Equus_ferus longevity 2
3 Jacob et al 2004 A Yes Tubul-ligation No Intact (no surgery) No Female Rattus argentiventer Ricefield rats NA Outdoor enclosure No Unknown - wild caught (approx 100g) Adult (young) 4 NA 2 0.2800 0.6700 NA 6.000 34.0000 NA Survival rate (%) One breeding season S.E.M NA NA NA NA NA NA NA 18 6 NA 25% population sterilized data from two enclosures pooled The impact of sterilized females on enclosed populations of ricefield rats Estimated age at treatment from data on weight at surgery. They were approximately 100g and are never referred to as sexually immature. 1Pregnancy occurs from when the animals are 60-120 g in weight (Sudarmaji 2002). Rattus_argentiventer mortality 3
4 Jacob et al 2004 A Yes Tubul-ligation No Intact (no surgery) No Female Rattus argentiventer Ricefield rats NA Outdoor enclosure No Unknown - wild caught (approx 100g) Adult (young) 4 NA 3 0.1400 0.2500 NA 6.000 8.0000 NA Survival rate (%) One breeding season S.E.M NA NA NA NA NA NA NA 12 12 NA 50% population sterilzed data from two enclosures pooled The impact of sterilized females on enclosed populations of ricefield rats NA Rattus_argentiventer mortality 4
5 Jacob et al 2004 A Yes Tubul-ligation No Intact (no surgery) No Female Rattus argentiventer Ricefield rats NA Outdoor enclosure No Unknown - wild caught (approx 100g) Adult (young) 4 NA 4 0.2200 0.1700 NA 6.000 6.0000 NA Survival rate (%) One breeding season S.E.M NA NA NA NA NA NA NA 6 18 NA 75% population sterilized data from two enclosures pooled The impact of sterilized females on enclosed populations of ricefield rats NA Rattus_argentiventer mortality 5
6 Jacob et al 2004 B Yes Tubul-ligation No Intact (no surgery) No Female Rattus argentiventer Ricefield rats NA Wild Yes Unknown - wild caught (approx 100g) Adult (young) 4 NA 10 0.4100 0.4200 NA 0.110 0.1700 NA Survival rate (%) two months deviance NA NA NA NA NA NA NA 13 24 NA Radiocollared - Animals spread across 4 plots giving error for survival NA NA Rattus_argentiventer mortality 6
7 Jacob et al 2004 B Yes Progesterone treatment No Untreated No Female Rattus argentiventer Ricefield rats NA Wild Yes Unknown - wild caught (approx 100g) Adult (young) 4 NA 10 0.4100 0.4000 NA 0.110 0.0000 NA Survival rate (%) two months deviance NA NA NA NA NA NA NA 15 24 NA Radiocollared -Animals spread across 4 plots giving error for survival. Progesterone treatment wore off and some females got pregnant NA NA Rattus_argentiventer mortality 7
8 Twigg et al 2000 Yes Tubul-ligation No Sham surgery or no surgery No Female Oryctolagus cuniculus Rabbit NA Outdoor enclosure Yes Unknown - wild caught (see notes for age estimation) Adult 4 NA 5 0.1330 0.4180 0.165 NA NA NA Survival rate (%) Four years NA NA NA NA NA NA NA NA 225 165 435 1993 cohorts. Assuming adults at sterilization because they do not refer to kittens, and because they show the survival of sterile females against intact females and intact adult males. They also show a plot of kitten survival and show that it is very poor NA NA Oryctolagus_cuniculus mortality 8
9 Twigg et al 2000 Yes Tubul-ligation No Sham surgery or no surgery No Female Oryctolagus cuniculus Rabbit NA Outdoor enclosure Yes Unknown - wild caught - yearling. Puberty or adult? NA NA NA 6 0.2390 0.3630 0.221 NA NA NA Survival rate (%) Four years NA NA NA NA NA NA NA NA 109 63 267 1994 cohorts NA NA Oryctolagus_cuniculus mortality 9
10 Twigg et al 2000 Yes Tubul-ligation No Sham surgery or no surgery No Female Oryctolagus cuniculus Rabbit NA Outdoor enclosure Yes Unknown - wild caught - yearly. Puberty or adult? NA NA NA 7 0.2100 0.3140 0.209 NA NA NA Survival rate (%) Four years NA NA NA NA NA NA NA NA 252 155 382 1995 cohorts - Also survival data and data split into different densities NA NA Oryctolagus_cuniculus mortality 10
11 Gipps and Jewel 1979 Yes Castration Yes Sham surgery Yes Male Myodes glareolus Bank vole NA Outdoor enclosure No Immature Prepuberty 2 NA 8 0.7820 0.9570 NA NA NA NA Survival rate (%) 6 months NA NA NA NA NA NA NA NA 23 23 NA No reproduction in enclosure so density both treatments exposed to would be the same NA NA Myodes_glareolus mortality 11
12 Gipps and Jewel 1979 Yes Castration Yes Sham surgery Yes Male Myodes glareolus Bank vole NA Outdoor enclosure No Immature Prepuberty 2 NA 9 0.7590 1.0000 0.700 NA NA NA Survival rate (%) 11 months NA NA NA NA NA NA NA NA 29 18 40 Some intacts were in a control enclosure without castrates. In the enclosure with castrates the density in the enclosure increased slightly quicker NA NA Myodes_glareolus mortality 12
13 Zakeri et al 2019 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mouse NMRI Laboratory No 10 months Adult (old) 4 NA 11 0.3600 0.5000 NA NA NA NA Survival rate (%) 11.5 months NA NA NA NA NA NA NA NA 16 16 NA Its the sterilization treatment that is compared to two different types of control in this study NA NA Mus_musculus mortality 13
14 Zakeri et al 2019 Yes Ovariectomy Yes Sham surgery Yes Female Mus musculus Mouse NMRI Laboratory No 10 months Adult (old) 4 NA 11 0.3300 0.5000 NA NA NA NA Survival rate (%) 11.5 months NA NA NA NA NA NA NA NA 16 16 NA Its the sterilization treatment that is compared to two different types of control in this study NA NA Mus_musculus mortality 14
15 Dorner 1973 Yes Castration Yes Untreated No Male Rattus norvegicus Rat Sprague-Dawley-Stammes Laboratory No Day after birth Birth 1 NA 12 570.0000 696.0000 NA 122.000 132.0000 NA Mean days Standard Deviation 122.000000 132.000000 NA NA NA NA NA 12 8 NA NA NA NA Rattus_norvegicus longevity 15
16 Asdell et al 1967 Yes Ovariectomy Yes Intact (no surgery) No Female Rattus norvegicus Rat Cornell Nutrion colony Laboratory No Between 38-42 days Puberty 3 NA 13 742.0000 669.0000 615.000 24.000 26.0000 21.000 Mean days S.E.M 169.705627 183.847763 148.492424 NA NA NA NA 50 50 50 Also data for mated females but havent included as would be a different environment (e.g. With males) NA NA Rattus_norvegicus longevity 16
17 Asdell et al 1967 Yes Castration Yes Intact (no surgery) No Male Rattus norvegicus Rat Cornell Nutrion colony Laboratory No Between 39-42 days Puberty 3 NA 14 615.0000 651.0000 742.000 21.000 26.0000 24.000 Mean days S.E.M 148.492424 183.847763 169.705627 NA NA NA NA 50 50 50 NA NA NA Rattus_norvegicus longevity 17
18 Asdell and Joshi 1976 Yes Ovariectomy Yes Intact (no surgery) No Female Rattus norvegicus Rat Manor-Wistar Laboratory No 45 days old Puberty 3 NA 15 654.0000 844.0000 661.000 24.000 24.0000 30.000 Mean days S.E.M 169.705627 169.705627 212.132034 NA NA NA NA 50 50 50 NA NA NA Rattus_norvegicus longevity 18
19 Asdell and Joshi 1976 Yes Castration Yes Intact (no surgery) No Male Rattus norvegicus Rat Manor-Wistar Laboratory No 45 days old Puberty 3 NA 16 661.0000 775.0000 654.000 30.000 30.0000 24.000 Mean days S.E.M 212.132034 212.132034 169.705627 NA NA NA NA 50 50 50 NA NA NA Rattus_norvegicus longevity 19
20 Arriola Apelo et al 2020 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice C57BL6 Laboratory No 21 days Prepuberty 2 NA 17 1006.0000 978.0000 853.000 34.300 37.4500 26.250 Median days S.E.M 145.522576 183.466782 136.399001 NA NA NA NA 18 24 27 NA NA NA Mus_musculus longevity 20
21 Arriola Apelo et al 2020 Yes Ovariectomy Yes Sham surgery Yes Female Mus musculus Mice C57BL6 Laboratory No 21 days Prepuberty 2 NA 18 853.0000 916.0000 1006.000 26.250 49.3600 34.300 Median days S.E.M 136.399001 231.518922 145.522576 NA NA NA NA 27 22 18 NA NA NA Mus_musculus longevity 21
22 Benedusi et al 2015 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice C57BL76 (ERE-LucRepTOP™) Laboratory No 5 Months Adult (old) 4 NA 19 0.1000 0.3500 NA NA NA NA Survival rate (%) 15 Months NA NA NA NA NA NA NA NA 20 20 NA NA NA NA Mus_musculus mortality 22
24 Cargil et al 2003 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice CBA Laboratory No 21 days Prepuberty 2 NA 21 599.2900 578.6400 NA 30.450 35.6000 NA Median Days S.E.M 158.222841 178.000000 NA NA NA NA NA 27 25 NA Extracted median lifespan from data in figure and calculated SD NA NA Mus_musculus longevity 23
25 Cox et al 2014 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Wild Yes Unknown - wild caught - assuming adult because caught at the same time of year as other studies, but work "adult" not specifically mentioned. Adult 4 NA 22 0.2600 0.3300 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 168 170 NA Raw data from Dyrad. My survival estimates from survival dont equal those extracted from the model, that probably includes covariates NA NA Anolis_sagrei mortality 24
26 Cox et al 2014 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Wild Yes Unknown - wild caught Adult 4 NA 22 0.3000 0.2000 NA NA NA NA Survival rate (%) Winter (Sept-May) NA NA NA NA NA NA NA NA 20 20 NA Remaining animals from first mortality assessment and only controls where fat was not removed. My survival estimates from those alive after monitored period NA NA Anolis_sagrei mortality 25
27 Cox and Calsbeek 2010 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Wild Yes Unknown - wild caught Adult 4 NA 23 0.0800 0.2400 NA NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 188 194 NA Data is also available for Summer and winter mortality, seperately NA NA Anolis_sagrei mortality 26
28 Cox et al 2010 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Wild Yes Adult - wild caught Adult 4 NA 24 0.2300 0.3400 NA NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 105 106 NA NA NA NA Anolis_sagrei mortality 27
29 Reedy et al 2016 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Wild Yes Unknown - wild caught adult after start of breeding Adult (young) 4 NA 25 0.2500 0.2100 0.550 NA NA NA Survival rate (%) 10 weeks (of breeding season) NA NA NA NA NA NA NA NA 110 110 60 NA NA NA Anolis_sagrei mortality 28
30 Reedy et al 2016 Yes Castration Yes Sham surgery Yes Male Anolis sagrei Anole lizards NA Wild Yes Unknown - wild caught adult after start of breeding Adult (young) 4 NA 26 0.5500 0.2800 0.250 NA NA NA Survival rate (%) 10 weeks (of breeding season) NA NA NA NA NA NA NA NA 60 60 110 NA NA NA Anolis_sagrei mortality 29
31 Drori and Folman 1976 Yes Castration Yes Intact (no surgery) No Male Rattus norvegicus Rat Albino Laboratory No 38-44 days. Stated as prepuberty Prepuberty 2 NA 27 727.0000 817.0000 849.000 26.000 32.0000 26.000 Mean Days S.E.M 182.000000 224.000000 182.000000 NA NA NA NA 49 49 49 Authors state that they castrated animals shortly before puberty, so coded as prepuberty NA NA Rattus_norvegicus longevity 30
32 Garratt et al 2021 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice C57BL6 Laboratory No 7-8 weeks Adult (young) 4 NA 28 952.0000 960.0000 956.000 20.700 36.4000 28.500 Median Days S.E.M 117.096883 218.400000 156.100929 NA NA NA NA 32 36 30 NA NA NA Mus_musculus longevity 31
33 Hamilton et al 1969 No Castration Yes Intact (no surgery) No Male Felis catus Cats Outbred Domestic No Under 5 months (before sexual maturity) Prepuberty 2 NA 29 5.3000 12.2000 7.700 0.420 1.4800 0.520 Mean Years S.E.M 4.136520 5.336216 4.794163 NA NA NA NA 97 13 85 Correlative data is provided in a figure showing exact age at gonadectomy and lifespan for each individual NA NA Felis_catus longevity 32
34 Hamilton et al 1969 No Castration Yes Intact (no surgery) No Male Felis catus Cats Outbred Domestic No 6 to 7 months Puberty 3 NA 29 5.3000 8.6000 7.700 0.420 1.1200 0.520 Mean Years S.E.M 4.136520 5.371331 4.794163 NA NA NA NA 97 23 85 NA NA NA Felis_catus longevity 33
35 Hamilton et al 1969 No Castration Yes Intact (no surgery) No Male Felis catus Cats Outbred Domestic No over 8 months Adult 4 NA 29 5.3000 7.2000 7.700 0.420 0.7100 0.520 Mean Years S.E.M 4.136520 4.376734 4.794163 NA NA NA NA 97 38 85 NA NA NA Felis_catus longevity 34
36 Hamilton et al 1969 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Outbred Domestic No Various, median 6 months NA NA NA 30 7.7000 8.2000 5.300 0.520 0.5200 0.420 Mean Years S.E.M 4.794163 4.503332 4.136520 NA NA NA NA 85 75 97 NA NA NA Felis_catus longevity 35
37 Hamilton et al 1969 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Name breeds Domestic No Various, median 6 months NA NA NA 31 6.2000 8.2000 4.600 0.840 0.8100 0.700 Mean Years S.E.M 5.040000 4.723071 3.500000 NA NA NA NA 36 34 25 NA NA NA Felis_catus longevity 36
38 Hamilton et al 1969 No Castration Yes Intact (no surgery) No Male Felis catus Cats Name breeds Domestic No Various, median 6 months NA NA NA 32 4.6000 6.9000 6.200 0.700 0.5900 0.840 Mean Years S.E.M 3.500000 4.971428 5.040000 NA NA NA NA 25 71 36 NA NA NA Felis_catus longevity 37
39 Waters et al 2011 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Rottweilers Domestic No 6.1-8 years Adult (old) 4 NA 33 0.2670 1.0000 NA NA NA NA Likelyhood of exceptional longevity Survival to 13 NA NA NA NA NA NA NA NA 14 14 NA Look at whether animals were normally lived, or lived over 13 years. Author is providing me with the raw data NA NA Canis_lupus mortality 38
40 Waters et al 2011 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Rottweilers Domestic No 2.1-6 years Adult (young) 4 NA 33 0.2670 0.4390 NA NA NA NA Likelyhood of exceptional longevity Survival to 13 NA NA NA NA NA NA NA NA 14 57 NA Look at whether animals were normally lived, or lived over 13 years. Author is providing me with the raw data NA NA Canis_lupus mortality 39
41 Waters et al 2011 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Rottweilers Domestic No 0.4-2 years. Estimated as puberty because rott weilers start to go through heat at approximately 12-18 months Puberty 3 NA 33 0.2670 0.3230 NA NA NA NA Likelyhood of exceptional longevity Survival to 13 NA NA NA NA NA NA NA NA 14 65 NA Look at whether animals were normally lived, or lived over 13 years. Author is providing me with the raw data NA NA Canis_lupus mortality 40
42 Holland et al 1977 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice RFM Laboratory No 3-4 weeks Prepuberty 2 NA 34 638.0000 628.0000 NA 16.000 16.0000 NA Mean Days S.E.M 167.044904 162.382265 NA NA NA NA NA 109 103 NA Just used data from non-irradiated group. Lots of pathology data NA NA Mus_musculus longevity 41
43 Kirkman and Yau 1972 No Castration Yes Intact (no surgery) No Male Mesocricetus auratus Hamsters Syrian Hamsters Laboratory No Unknown - not given NA NA NA 35 632.0000 508.0000 543.000 NA NA NA Mean Days NA 222.910000 151.300000 222.950000 NA NA NA NA 629 72 578 Do not have error presented in paper. The proportion of animals dying in 10 brackets of different ages is presented that could be used (Figs 3 and 4). Upper and low quartiles estimated from figure 3 when number of animals dying in 100 day periods is given. Have used the middle number within this period for the quartile value (e.g. 550-850 for intact males, 350-550 for castrated males) NA NA Mesocricetus_auratus longevity 42
44 Kirkman and Yau 1972 No Ovariectomy Yes Intact (no surgery) No Female Mesocricetus auratus Hamsters Syrian Hamsters Laboratory No Unknown - not given NA NA NA 36 543.0000 391.0000 632.000 NA NA NA Mean Days NA 222.950000 155.440000 222.910000 NA NA NA NA 578 31 629 Do not have error presented in paper. The proportion of animals dying in 10 brackets of different ages is presented that could be used (Figs 3 and 4). Upper and low quartiles estimated from figure 3 when number of animals dying in 100 day periods is given. Have used the middle number within this period for the quartile value (e.g. 450-750 for intact females, 250-450 for castrated females) NA NA Mesocricetus_auratus longevity 43
45 Sichuk 1965 Yes Castration Yes Sham surgery Yes Male Mesocricetus auratus Hampsters Syrian Hampsters Laboratory No 6 weeks Puberty 3 NA 37 612.0000 578.0000 589.000 NA NA NA Mean Days NA 222.910000 151.300000 222.950000 NA NA NA NA 92 90 94 Use - SD from Kirkman & Yau;Error not provided. Mean lifespan comes from the lifespan of both those with thrumobis and those that do not have it. Calculated the mean of these two values weighed against the sample size of each group NA NA Mesocricetus_auratus longevity 44
46 Sichuk 1965 Yes Ovariectomy Yes Sham surgery Yes Female Mesocricetus auratus Hampsters Syrian Hampsters Laboratory No 6 weeks Puberty 3 NA 38 589.0000 586.0000 612.000 NA NA NA Mean Days NA 222.950000 155.440000 222.910000 NA NA NA NA 94 92 92 Use - SD from Kirkman & Yau;Error not provided. Mean lifespan comes from the lifespan of both those with thrumobis and those that do not have it. Calculated the mean of these two values weighed against the sample size of each group NA NA Mesocricetus_auratus longevity 45
47 Mitchel et al 1999 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 39 131.0000 128.0000 130.000 1.400 2.7000 1.800 Mean Months S.E.M 50.029192 46.058550 51.951131 NA NA NA NA 1277 291 833 Used all causes of death. Data collected on the basis of surveys that pet owners filled out about their last pets age at death NA NA Canis_lupus longevity 46
48 Mitchel et al 1999 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 40 130.0000 144.0000 131.000 1.800 1.5000 1.400 Mean Months S.E.M 51.951131 40.249224 50.029192 NA NA NA NA 833 720 1277 Used all causes of death. Data collected on the basis of surveys that pet owners filled out about their last pets age at death NA NA Canis_lupus longevity 47
49 Moore et al 2001 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Military working dogs Domestic No Various NA NA NA 41 9.9700 10.4900 NA 2.100 2.0600 NA Median Years Standard deviation 2.100000 2.060000 NA NA NA NA NA 641 143 NA Shinichi made decisoin to halve the rest of N to control and the opposit sex;Do not know the sample size of castrated males. 641/927 animals in the study are intact males, the remaining animals are either castrated males or spayed females but we do not know sample size of each of these two groups. NA NA Canis_lupus longevity 48
50 Nieschlag et al 1993 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans NA NA No Castrate prepubertal boys to prevent maturation of voice Prepuberty 2 NA 42 64.3000 65.5000 NA 14.100 13.8000 NA Mean Years Standard Deviation 14.100000 13.800000 NA NA NA NA NA 200 50 NA NA NA NA Homo_sapiens longevity 49
51 Slonaker 1930 Yes Castration Yes Intact (no surgery) No Male Rattus norvegicus Rat Albino Laboratory No 44 days. Testes had decended by the operation Adult (young) 4 NA 43 788.0000 770.0000 863.000 22.250 28.0000 27.690 Mean Days Probable error 32.987398 41.512231 41.052632 NA NA NA NA 10 8 17 NA NA NA Rattus_norvegicus longevity 50
53 Slonaker 1930 Yes Ovariectomy Yes Intact (no surgery) No Female Rattus norvegicus Rat Albino Laboratory No 27.5 days Prepuberty 2 NA 44 863.0000 755.0000 788.000 27.690 22.1500 22.250 Mean Days Probable error 41.052632 32.839140 32.987398 NA NA NA NA 17 37 10 NA NA NA Rattus_norvegicus longevity 51
54 Slonaker 1930 Yes Hysterectomy No Intact (no surgery) No Female Rattus norvegicus Rat Albino Laboratory No 29 days Prepuberty 2 NA 44 863.0000 855.0000 788.000 27.690 12.6700 22.250 Mean Days Probable error 41.052632 18.784285 32.987398 NA NA NA NA 17 60 10 NA NA NA Rattus_norvegicus longevity 52
55 Storer et al 1982 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice RFM Laboratory No 50 days Adult (young) 4 NA 45 643.4000 662.2000 NA 5.910 7.3100 NA Mean Days S.E.M. 161.311607 134.193762 NA NA NA NA NA 745 337 NA Non-irradiated controls from an irradiation experiment NA NA Mus_musculus longevity 53
56 Storer et al 1982 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice Balb/c Laboratory No 50 days Adult (young) 4 NA 46 762.9000 795.5000 NA 6.210 10.9500 NA Mean Days S.E.M. 179.016109 197.707397 NA NA NA NA NA 831 326 NA Non-irradiated controls from an irradiation experiment NA NA Mus_musculus longevity 54
57 Hoffman et al 2018 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 47 10.8600 11.6400 10.860 0.110 0.0700 0.140 Mean Years S.E.M 3.327386 2.033618 3.685485 NA NA NA NA 915 844 693 Vetcompass database NA NA Canis_lupus longevity 55
58 Hoffman et al 2018 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 48 10.8600 12.1200 10.860 0.140 0.1900 0.110 Mean Years S.E.M 3.685485 5.766116 3.327386 NA NA NA NA 693 921 915 Vetcompass database NA NA Canis_lupus longevity 56
59 Hoffman et al 2018 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 49 8.0000 9.2100 7.680 0.070 0.0400 0.070 Mean Years S.E.M 8.556337 4.241509 6.018372 NA NA NA NA 14941 11244 7392 VMDB - individual data for breeds available in supplementary, but just mean lifespan without error NA NA Canis_lupus longevity 57
60 Hoffman et al 2018 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 50 7.6800 9.7300 8.000 0.070 0.0400 0.070 Mean Years S.E.M 6.018372 5.599714 8.556337 NA NA NA NA 7392 19598 14941 VMDB - individual data for breeds available in supplementary, but just mean lifespan without error NA NA Canis_lupus longevity 58
61 Mason et al 2009 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice CBA Laboratory No 21 days Prepuberty 2 NA 51 727.6000 715.0000 NA 15.900 20.0000 NA Mean Days S.E.M 89.943983 101.980390 NA NA NA NA NA 32 26 NA Worked out sample size from fig 4 This and the other entry for this paper have two different control comparisons NA NA Mus_musculus longevity 59
62 Mason et al 2009 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mice CBA Laboratory No 21 days Prepuberty 2 NA 51 725.6000 715.0000 NA 20.400 20.0000 NA Mean Days S.E.M 117.189078 101.980390 NA NA NA NA NA 33 26 NA Worked out sample size from fig 4 NA NA Mus_musculus longevity 60
63 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Yes Male Rattus norvegicus Rats Lewis Laboratory No Birth Birth 1 NA 52 454.0000 521.0000 484.000 18.000 27.0000 19.000 Mean Days S.E.M 108.000000 174.979999 123.134073 NA NA NA NA 36 42 42 NA NA NA Rattus_norvegicus longevity 61
64 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Yes Male Rattus norvegicus Rats Lewis Laboratory No 22-28 days Prepuberty 2 NA 52 454.0000 488.0000 484.000 18.000 28.0000 19.000 Mean Days S.E.M 108.000000 165.650234 123.134073 NA NA NA NA 36 35 42 NA NA NA Rattus_norvegicus longevity 62
65 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Yes Male Rattus norvegicus Rats Lewis Laboratory No 100 days Adult (young) 4 NA 52 454.0000 439.0000 484.000 18.000 25.0000 19.000 Mean Days S.E.M 108.000000 119.895788 123.134073 NA NA NA NA 36 23 42 NA NA NA Rattus_norvegicus longevity 63
66 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Lewis Laboratory No Birth Birth 1 NA 53 484.0000 574.0000 454.000 19.000 33.0000 18.000 Mean Days S.E.M 123.134073 183.736224 108.000000 NA NA NA NA 42 31 36 NA NA NA Rattus_norvegicus longevity 64
67 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Lewis Laboratory No 22-28 days Prepuberty 2 NA 53 484.0000 480.0000 454.000 19.000 44.0000 18.000 Mean Days S.E.M 123.134073 206.378293 108.000000 NA NA NA NA 42 22 36 NA NA NA Rattus_norvegicus longevity 65
68 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Lewis Laboratory No 100 days Adult (young) 4 NA 53 484.0000 515.0000 454.000 19.000 41.0000 18.000 Mean Days S.E.M 123.134073 183.357574 108.000000 NA NA NA NA 42 20 36 NA NA NA Rattus_norvegicus longevity 66
69 Tapprest et al 2017 No Castration Yes Intact (no surgery) No Male Equus ferus Draught horse NA Farm No Unknown Unknown NA NA 54 0.1520 0.1740 0.103 NA NA NA Survival rate (%) to 10 years NA NA NA NA NA NA NA NA 132 23 638 No error provided with median lifespan but there is proportion surviving to a specific age, which includes condfidence intervals, and survival curves. Have used survival to 10 yeays of age. NA NA Equus_ferus mortality 67
70 Tapprest et al 2017 No Castration Yes Intact (no surgery) No Male Equus ferus Pony NA Farm No Unknown Unknown NA NA 55 0.6970 0.6970 0.709 NA NA NA Survival rate (%) to 10 years NA NA NA NA NA NA NA NA 211 201 533 No error provided with median lifespan but there is proportion surviving to a specific age, which includes condfidence intervals, and survival curves. Have used survival to 10 yeays of age. NA NA Equus_ferus mortality 68
71 Tapprest et al 2017 No Castration Yes Intact (no surgery) No Male Equus ferus Saddle horse NA Farm No Unknown Unknown NA NA 56 0.5620 0.5540 0.575 NA NA NA Survival rate (%) to 10 years NA NA NA NA NA NA NA NA 1077 2203 4124 No error provided with median lifespan but there is proportion surviving to a specific age, which includes condfidence intervals, and survival curves. Have used survival to 10 yeays of age. NA NA Equus_ferus mortality 69
72 Hamilton 1965 No Castration Yes Intact (no surgery) No Male Felis catus Cats Various breeds Domestic No 6 -12 months for those that were known Puberty or adult NA NA 57 3.2000 6.8000 7.700 0.340 0.5800 0.680 Mean Years S.E.M 2.741168 4.492661 5.178726 NA NA NA NA 65 60 58 Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. NA NA Felis_catus longevity 70
73 Hamilton 1965 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Various breeds Domestic No 6 -12 months for those that were known Puberty or adult NA NA 58 7.7000 9.2000 3.200 0.680 0.8800 0.340 Mean Years S.E.M 5.178726 4.656522 2.741168 NA NA NA NA 58 28 65 Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. NA NA Felis_catus longevity 71
74 Hamilton 1965 No Castration Yes Intact (no surgery) No Male Felis catus Cats Various breeds Domestic No 6 -12 months for those that were known Puberty or adult NA NA 59 6.1000 8.5000 7.400 0.660 0.5600 0.720 Mean Years S.E.M 4.713343 4.913980 5.091169 NA NA NA NA 51 77 50 Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. NA NA Felis_catus longevity 72
75 Hamilton 1965 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Various breeds Domestic No 6 -12 months for those that were known Puberty or adult NA NA 60 7.4000 8.4000 6.100 0.720 0.7100 0.660 Mean Years S.E.M 5.091169 4.762825 4.713343 NA NA NA NA 50 45 51 Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. NA NA Felis_catus longevity 73
76 Huang et al 2017 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 61 9.0000 12.0000 10.000 NA NA NA Median Years Interquartile range 5.941000 3.723000 5.947000 NA NA NA NA 839 332 528 Interquartile range Intact, 5.0-13.0; castrated 9.0-14.0 NA NA Canis_lupus longevity 74
77 Huang et al 2017 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 62 10.0000 12.0000 9.000 NA NA NA Median Years Interquartile range 5.947000 3.938000 5.941000 NA NA NA NA 528 607 839 Interquartile range Intact, 5.0-13.0; ovariectomy 9.7-15.0 NA NA Canis_lupus longevity 75
78 Min et al 2012 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans NA NA No Various.The boys lost their reproductive organs in accidents, or they underwent deliberate castration to gain access to the palace before becoming a teenager. Prepuberty 2 NA 63 55.6000 70.0000 NA 0.530 1.7600 NA Median Years S.E.M 17.784639 15.840000 NA NA NA NA NA 1126 81 NA Mok family NA NA Homo_sapiens longevity 76
79 Min et al 2012 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans NA NA No Various.The boys lost their reproductive organs in accidents, or they underwent deliberate castration to gain access to the palace before becoming a teenager. Prepuberty 2 NA 63 52.9000 70.0000 NA 0.450 1.7600 NA Median Years S.E.M 16.921436 15.840000 NA NA NA NA NA 1414 81 NA Shin family NA NA Homo_sapiens longevity 77
80 Min et al 2012 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans NA NA No Various.The boys lost their reproductive organs in accidents, or they underwent deliberate castration to gain access to the palace before becoming a teenager. Prepuberty 2 NA 63 50.9000 70.0000 NA 2.160 1.7600 NA Median Years S.E.M 15.120000 15.840000 NA NA NA NA NA 49 81 NA Seo family NA NA Homo_sapiens longevity 78
81 Williams et al 2007 Yes Tubul-ligation No Intact (no surgery) No Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Unknown - wild caught (>500g weight) Adult (young) 4 NA 65 0.2710 0.4970 0.269 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 70 143 331 1993 cohort_treatment shared between two controls NA NA Oryctolagus_cuniculus mortality 79
82 Williams et al 2007 Yes Tubul-ligation No Sham surgery Yes Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Unknown - wild caught (>500g weight) Adult (young) 4 NA 65 0.2710 0.4970 0.269 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 140 143 331 1994 cohort_treatment shared between two controls NA NA Oryctolagus_cuniculus mortality 80
83 Williams et al 2007 Yes Tubul-ligation No Intact (no surgery) No Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Yearling (>500g) Puberty or adult? NA NA NA 66 0.5120 0.5160 0.271 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 41 128 280 1994 cohort_Treatment shared NA NA Oryctolagus_cuniculus mortality 81
84 Williams et al 2007 Yes Tubul-ligation No Sham surgery Yes Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Yearling (>500g) Puberty or adult? NA NA NA 66 0.3770 0.5160 0.271 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 77 128 280 1994 cohort_Treatment shared NA NA Oryctolagus_cuniculus mortality 82
85 Williams et al 2007 Yes Tubul-ligation No Intact (no surgery) No Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Yearling (>500g) Puberty or adult? NA NA NA 67 0.2790 0.5180 0.347 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 43 114 236 1995 cohort_Treatment shared NA NA Oryctolagus_cuniculus mortality 83
86 Williams et al 2007 Yes Tubul-ligation No Sham surgery Yes Female Oryctolagus cuniculus Rabbits European Rabbit Wild Yes Yearling (>500g) Puberty or adult? NA NA NA 67 0.3380 0.5180 0.347 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 68 114 236 1995 cohort_Treatment shared NA NA Oryctolagus_cuniculus mortality 84
87 Urfer et al 2019 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 68 14.0900 14.1500 13.770 0.033 0.0130 0.046 Median years 95% Confidence intervals 18.753700 12.400487 22.107487 NA 0.033 0.0130 0.046 322958 909894 230974 95% confidence intervals Intact Male: 14.03-14.16; Castrated male: 14.13-14.18 NA NA Canis_lupus longevity 85
88 Urfer et al 2019 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 69 13.7700 14.3500 14.090 0.046 0.0102 0.033 Median years 95% Confidence intervals 22.107487 9.710121 18.753700 NA 0.046 0.0102 0.033 230974 906252 322958 95% confidence intervals Intact female: 13.68-13.86, OVX female: 14.33-14.37 NA NA Canis_lupus longevity 86
89 Ramsey 2005 Yes Tubul-ligation No Sham surgery Yes Female Trichosurus vulpecula Possum NA Wild Yes Various Adult 4 NA 70 0.7800 0.8700 NA NA NA NA Survival rate (%) Annual (taken from 4 years) NA NA NA NA NA NA NA NA 56 56 NA Orongorono 50% sterility_Survival from Fig 7, sample sizes from number of animals released over the years 1996-1999 NA NA Trichosurus_vulpecula mortality 87
90 Ramsey 2005 Yes Tubul-ligation No Sham surgery Yes Female Trichosurus vulpecula Possum NA Wild Yes Various Adult 4 NA 71 0.7200 0.8300 NA NA NA NA Survival rate (%) Annual (taken from 4 years) NA NA NA NA NA NA NA NA 36 142 NA Orongorono 80% sterility_Survival from Fig 7, sample sizes from number of animals released over the years 1996-1999 NA NA Trichosurus_vulpecula mortality 88
91 Ramsey 2005 Yes Tubul-ligation No Sham surgery Yes Female Trichosurus vulpecula Possum NA Wild Yes Various Adult 4 NA 72 0.6300 0.7600 NA NA NA NA Survival rate (%) Annual (taken from 4 years) NA NA NA NA NA NA NA NA 215 215 NA Turitea 50% sterility_Survival from Fig 7, sample sizes from number of animals released over the years 1996-1999. Confidence intervals are provided NA NA Trichosurus_vulpecula mortality 89
92 Ramsey 2005 Yes Tubul-ligation No Sham surgery Yes Female Trichosurus vulpecula Possum NA Wild Yes Various Adult 4 NA 73 0.6000 0.7400 NA NA NA NA Survival rate (%) Annual (taken from 4 years) NA NA NA NA NA NA NA NA 31 123 NA Turitea 80% sterility_Survival from Fig 7, sample sizes from number of animals released over the years 1996-1999 NA NA Trichosurus_vulpecula mortality 90
93 Ramsey et al 2021 Yes levonorgestrel implant No Sham capture Yes Female Phascolarctos cinereus Koala NA Wild Yes Mature females, as definted by toothwear, under 1 year Adult (young) 4 NA 74 0.7200 0.7800 NA NA NA NA Survival rate (%) Annual (average from across all years) NA NA NA NA NA NA NA NA 603 4355 NA Survival rate taken as the average across all years. Sample size is also from across all years. Yearly data is also available in supplementary. Confidence intervals are provided. NA NA Phascolarctos_cinereus mortality 91
94 Muhlock 1959 Yes Castration Yes Intact (no surgery) No Male Mus musculus Mouse DBA Laboratory No Weaning (1month) Prepuberty 2 NA 75 578.0000 595.0000 667.000 10.120 11.4400 9.570 Mean days S.E.M 78.389183 102.322471 88.748529 NA NA NA NA 60 80 86 Extracted data and calculated mean and SE from graph NA NA Mus_musculus longevity 92
95 Muhlock 1959 Yes Ovariectomy Yes Intact (no surgery) No Female Mus musculus Mouse DBA Laboratory No Weaning (1 month) Prepuberty 2 NA 76 667.0000 627.0000 578.000 9.570 10.6700 10.120 Mean days S.E.M 88.748529 87.987074 78.389183 NA NA NA NA 86 68 60 Extracted data and calculated mean and SE from graph NA NA Mus_musculus longevity 93
96 Jewel 1997 Yes Castration Yes Intact (no surgery) No Male Ovis aries Sheep Soay sheep Wild Yes Lambs Birth 1 NA 77 0.3600 0.7100 0.410 NA NA NA Survival rate (%) one year NA NA NA NA NA NA NA NA 14 14 54 1978 Calaculated the survival rate to the timepoint nearest 50% intact male survival NA NA Ovis_aries mortality 94
97 Jewel 1997 Yes Castration Yes Intact (no surgery) No Male Ovis aries Sheep Soay sheep Wild Yes Lambs Birth 1 NA 78 0.2000 0.8800 0.910 NA NA NA Survival rate (%) One year NA NA NA NA NA NA NA NA 8 5 44 1979 NA NA Ovis_aries mortality 95
98 Jewel 1997 Yes Castration Yes Intact (no surgery) No Male Ovis aries Sheep Soay sheep Wild Yes Lambs Birth 1 NA 79 0.0800 0.6600 0.400 NA NA NA Survival rate (%) Five years NA NA NA NA NA NA NA NA 50 50 83 1980. Calculated the survival rate to timepoint nearest to 50% intact male survival, and where there is data for all groups. A survival curve is also available but there is alot of missing data NA NA Ovis_aries mortality 96
99 Iwasa et al 2018 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Sprague-Dawley Laboratory No 23 weeks Late adult 4 NA 80 0.4300 0.8600 NA NA NA NA Survival rate (%) ~85 weeks. NA NA NA NA NA NA NA NA 8 7 NA Calculated from a partial survival curve. Looked at when 50% of the control group died and then the number alive in the treatment group at this point NA NA Rattus_norvegicus mortality 97
100 Hamilton and Mestler 1969 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans Mentally handicaped individuals NA No 8-14 years (prepubertal) Prepuberty 2 NA 81 64.7000 76.3000 NA 0.990 1.3600 NA Median lifespan (for those alive at 40) Years S.E.M 17.709658 5.769991 NA NA NA NA NA 320 18 NA Median lifespan data from Table 10. This data is taken from those individuals alive at 40. Data for those alive at earlier ages is also available but not stratified into different surgery ages NA NA Homo_sapiens longevity 98
101 Hamilton and Mestler 1969 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans Mentally handicaped individuals NA No 15-19 years Adult (young) 4 NA 81 64.7000 72.9000 NA 0.990 5.1300 NA Median lifespan (for those alive at 40) Years S.E.M 17.709658 43.529493 NA NA NA NA NA 320 72 NA Median lifespan data from Table 10. This data is taken from those individuals alive at 40. Data for those alive at earlier ages is also available but not stratified into different surgery ages NA NA Homo_sapiens longevity 99
102 Hamilton and Mestler 1969 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans Mentally handicaped individuals NA No 20-29 years Adult (young) 4 NA 81 64.7000 69.6000 NA 0.990 2.5000 NA Median lifespan (for those alive at 40) Years S.E.M 17.709658 19.525624 NA NA NA NA NA 320 61 NA Median lifespan data from Table 10. This data is taken from those individuals alive at 40. Data for those alive at earlier ages is also available but not stratified into different surgery ages NA NA Homo_sapiens longevity 100
103 Hamilton and Mestler 1969 No Castration Yes Intact (no surgery) No Male Homo sapiens Humans Mentally handicaped individuals NA No 30-39 years Adult (old) 4 NA 81 64.7000 68.9000 NA 0.990 2.0500 NA Median lifespan (for those alive at 40) Years S.E.M 17.709658 14.350000 NA NA NA NA NA 320 49 NA Median lifespan data from Table 10. This data is taken from those individuals alive at 40. Data for those alive at earlier ages is also available but not stratified into different surgery ages NA NA Homo_sapiens longevity 101
104 Hamilton and Mestler 1969 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans Mentally handicaped individuals NA No 13-46 years old Adult 4 NA 82 33.9000 56.2000 NA 1.360 4.6900 NA Median Years S.E.M 15.265962 15.554970 NA NA NA NA NA 126 11 NA Only one female was 13 years and all the rest were clearly adult so group coded as adult NA NA Homo_sapiens longevity 102
105 Oneil et al 2013 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 83 11.9900 11.9900 11.590 NA NA NA Mean Years Estimated NA NA NA 0.8 0.500 1.1000 Average difference in years to control 1464 1224 1082 Means calculated from the coefficient change in lifespan in Table 4. Sample size for all was known, SD was estimated NA NA Canis_lupus longevity 103
106 Oneil et al 2013 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 84 11.5900 12.3900 11.990 NA NA NA Mean Years Estimated NA NA NA Look at comments for Coefficent whiich is in relation to the control female from the same study) NA NA NA 1082 1304 1464 Means calculated from the coefficient change in lifespan in Table 4. Sample size for all was known, SD was estimated NA NA Canis_lupus longevity 104
107 Oneil et al 2015 No Castration Yes Intact (no surgery) No Male Felis catus Cats Various breeds Domestic No Various NA NA NA 85 12.8100 14.7100 14.610 NA NA NA Mean Years Estimated NA NA NA 0.6 0.100 1.0000 Average difference in years to control 704 1296 707 Means calculated from the coefficient change in lifespan in Table 4. Sample size for each sex was estimated on the basis of the total sample size and the percentage that were known to be sterilized in both sexes, SD was estimated NA NA Felis_catus longevity 105
108 Oneil et al 2015 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Various breeds Domestic No Various NA NA NA 86 14.6100 15.2100 12.810 NA NA NA Mean Years Estimated NA NA NA Look at comments for Coefficent whiich is in relation to the control female from the same study) NA NA NA 707 1302 704 Means calculated from the coefficient change in lifespan in Table 4. Sample size for each sex was estimated on the basis of the total sample size and the percentage that were known to be sterilized in both sexes, SD was estimated NA NA Felis_catus longevity 106
112 Wilson et al 2019 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No Under 50 years old Adult 4 NA 90 0.9351 0.9166 NA NA NA NA Survival rate (%) 21.5 years (median follow-up) NA NA NA NA NA NA NA NA 10218 851 NA Calculated survival rate from those surviving across the study period. Hazard ratios are also provided in the paper, and additional analysis cotrolling for factors. There is also analysis where women are seperated according to whether they have used hormone replacement therapy. Additional studies are cited that have conducted this type of analysis. NA NA Homo_sapiens mortality 107
113 Wilson et al 2019 No Hysterectomy No Intact (no surgery) No Female Homo sapiens Humans NA NA No Under 50 years old Adult 4 NA 90 0.9351 0.9324 NA NA NA NA Survival rate (%) 21.5 years (median follow-up) NA NA NA NA NA NA NA NA 10218 2472 NA Calculated survival rate from those surviving across the study period. Hazard ratios are also provided in the paper, and additional analysis cotrolling for factors. There is also analysis where women are seperated according to whether they have used hormone replacement therapy. Additional studies are cited that have conducted this type of analysis. NA NA Homo_sapiens mortality 108
114 Cheng 2019 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice UMHet3 Laboratory No Under 30 days is stated. The figure shows weights starting at approximately 15-20 days so this is used in the correlation analysis Prepuberty 2 NA 91 0.8100 0.9700 NA NA NA NA Survival rate (%) 500 days NA NA NA NA NA NA NA NA 238 238 NA NA NA NA Mus_musculus mortality 109
115 Bronson 1981 No Castration Yes Intact (no surgery) No Male Felis catus Cats Various breeds Domestic No After 6 months (they state few were done before neutered before 6 months or so) Puberty or adult NA NA 92 4.9700 7.3400 6.650 3.660 4.2900 5.660 Mean Years - for cats surviving to two years old Standard deviation 3.660000 4.290000 5.660000 NA NA NA NA 219 265 99 Lifespan of individuals calculated from histograms. Used data from animals that survived after the first year. NA NA Felis_catus longevity 110
116 Bronson 1981 No Ovariectomy Yes Intact (no surgery) No Female Felis catus Cats Various breeds Domestic No After 6 months (they state few were done before neutered before 6 months or so) Puberty or adult NA NA 93 6.6500 9.1100 4.970 5.660 5.1300 3.660 Mean Years - for cats surviving to two years old Standard deviation 5.660000 5.130000 3.660000 NA NA NA NA 99 220 219 Lifespan of individuals calculated from histograms. Used data from animals that survived after the first year. NA NA Felis_catus longevity 111
117 Bronson 1982 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Various breeds Domestic No Various NA NA NA 94 8.0000 9.9000 7.700 5.200 6.8000 4.400 Mean (from those alive after 2) Years Standard Deviation 5.200000 6.800000 4.400000 NA NA NA NA 755 54 224 Mean lifespan is that of those that are alive from 2 years of age. The authors also provide lifespan from birth, but point out that animals are not usually sterilized until at least 6 months, so this doesnt provide a fair comparison NA NA Canis_lupus longevity 112
118 Bronson 1982 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Various breeds Domestic No Various NA NA NA 95 7.7000 8.8000 8.000 4.400 6.9000 5.200 Mean (from those alive after 2) Years Standard Deviation 4.400000 6.900000 5.200000 NA NA NA NA 224 528 755 Mean lifespan is that of those that are alive from 2 years of age. The authors also provide lifespan from birth, but point out that animals are not usually sterilized until at least 6 months, so this doesnt provide a fair comparison NA NA Canis_lupus longevity 113
119 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site FP predation natural Yes Unknown NA NA NA 96 0.3590 0.5250 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 78 80 NA Site FP predation natural NA NA Anolis_sagrei mortality 114
120 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site FC no predation No Unknown NA NA NA 97 0.5430 0.3590 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 81 78 NA Site FC no predation. Included as not wild-semi wild because protected from predation NA NA Anolis_sagrei mortality 115
121 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site HC Bird predation Yes Unknown NA NA NA 98 0.3210 0.3920 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 81 79 NA Site HC Bird predation NA NA Anolis_sagrei mortality 116
122 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site FP Natural Yes Unknown NA NA NA 99 0.3270 0.5610 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 110 114 NA Site FP Natural NA NA Anolis_sagrei mortality 117
123 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site NC No predation No Unknown NA NA NA 100 0.2930 0.3470 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 75 75 NA Site NC No predation. Included as not wild semi-wild because protected from predation NA NA Anolis_sagrei mortality 118
124 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site FC Bird predation Yes Unknown NA NA NA 101 0.4930 0.5730 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 75 75 NA Site FC Bird predation NA NA Anolis_sagrei mortality 119
125 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site HC Bird and snake predation Yes Unknown NA NA NA 102 0.3330 0.2840 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 74 75 NA Site HC Bird and snake predation NA NA Anolis_sagrei mortality 120
126 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site Mc Bird and snake predation Yes Unknown NA NA NA 103 0.2670 0.2530 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 75 75 NA Site Mc Bird and snake predation NA NA Anolis_sagrei mortality 121
127 Cox et al 2021 Yes Ovariectomy Yes Sham surgery Yes Female Anolis sagrei Anole lizards NA Site FP natural Yes Unknown NA NA NA 104 0.2290 0.3400 NA NA NA NA Survival rate (%) One breeding season (May-Sept) NA NA NA NA NA NA NA NA 105 106 NA Site FP natural NA NA Anolis_sagrei mortality 122
128 Skinner 2007 Yes Tubul-ligation No Anesthetized but no surgery Yes Female Odocoileus virginianus White-tailed deer NA Suburban chicago No Unknown NA NA NA 105 0.7500 0.5200 0.660 NA NA NA Survival rate (%) four years NA NA NA NA NA NA NA NA 34 67 79 It is stated that more treatment does died from vechicle accidents (e.g. Human biased) NA NA Odocoileus_virginianus mortality 123
129 Kent et al 2018 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs Golden retriver Domestic No Unknown NA NA NA 106 8.6800 9.3500 5.890 NA NA NA Median Years Range 3.230000 2.710000 3.270000 NA NA NA NA 118 228 58 Standard deviation calculated from the range according to Wan et al 2014 NA NA Canis_lupus longevity 124
130 Kent et al 2018 No Ovariectomy Yes Intact (no surgery) No Female Canis lupus Dogs Golden retriver Domestic No Unknown NA NA NA 107 5.8900 9.5100 8.680 NA NA NA Median Years Range 3.270000 2.740000 3.230000 NA NA NA NA 58 248 118 Standard deviation calculated from the range according to Wan et al 2014 NA NA Canis_lupus longevity 125
131 Iversen et al 2007 No Tubul-ligation No Intact (no surgery) No Female Homo sapiens Humans NA NA No Various NA NA NA 108 0.9195 0.9124 NA NA NA NA Survival rate (%) 1968-2004 approx NA NA NA NA NA NA NA NA 2634 2511 NA Groups differ in some demographic factors ie parity. Used data from Table 3 (all cause dealth), where women who had a history of cancer or cardiovascular disease etc, before their operation or follow-up period, were excluded from the analysis (see statistics section). NA NA Homo_sapiens mortality 126
132 Sato et al 1997 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Sprague-Dawley Laboratory No 9 months Adult 4 NA 109 0.8000 0.9710 NA NA NA NA Survival rate (%) 6 months NA NA NA NA NA NA NA NA 35 35 NA NA NA NA Rattus_norvegicus mortality 127
133 Aida et al 1984 Yes Castration Yes Sham surgery Yes Male Oncorhynchus masou masu salmon NA Laboratory No precocious NA NA NA 110 0.3360 0.6200 NA NA NA NA Survival rate (%) 8 months NA NA NA NA NA NA NA NA 107 316 NA Experiments were conducted on precocious mature males. Need to work out how to classify this in terms of maturity at castration. Some males had partial gonads remaining at NA NA Oncorhynchus_masou mortality 128
135 Pullinger and Head 1964 Yes Ovariectomy Yes Untreated No Female Mus musculus Mice C3Hf Laboratory No 56-111 days of age Adult 4 NA 112 0.3700 0.2300 NA NA NA NA Survival rate (%) to 30 months NA NA NA NA NA NA NA NA 114 40 NA "average lifespan" in months is also provided but no error. Calculated the percentage surviving to 30 months as dead ranges are provided in 6 brackets and this is the closest to the median for control females. This group is control virgin females (OVX data was shared and compared to breeding females in the other female comparison for this paper but I removed it because I dont think social environment was comparable) NA NA Mus_musculus mortality 129
136 Robertson et al 1961 No Castration Yes Untreated No Male Oncorhynchus nerka Kokanee salmon NA Experimental pond No 2 years 1 month Prior to sexual maturity 2 NA 113 4.0500 5.3100 4.260 NA NA NA Mean NA NA 0.590000 1.600000 0.550000 NA NA NA NA 41 13 58 Only used data on animals that were found dead and did not have regenerating gonads. Mortality data is presented for a larger cohort that were also exposed to predation but control data is not seperated according to sex. NA NA Oncorhynchus_nerka longevity 130
137 Robertson et al 1961 No Ovariectomy Yes Untreated No Female Oncorhynchus nerka Kokanee salmon NA Experimental pond No 2 years 1 month Prior to sexual maturity 2 NA 114 4.2600 5.8900 4.050 NA NA NA Mean NA NA 0.550000 1.630000 0.590000 NA NA NA NA 58 16 41 Only used data on animals that were found dead and did not have regenerating gonads. Mortality data is presented for a larger cohort that were also exposed to predation but control data is not seperated according to sex. NA NA Oncorhynchus_nerka longevity 131
138 Saunders et al 2002 Yes Tubul-ligation No Intact (no surgery) No Female Vulpes vulpes Foxes NA Wild Yes Adult (toothwear) NA 4 NA 115 0.8300 0.8500 0.885 NA NA NA Survival rate (%) 2 years NA NA NA NA NA NA NA NA 6 20 26 Included as controled because comparison is to animals on the same site. Male data is also from the same site NA NA Vulpes_vulpes mortality 132
139 Saunders et al 2002 No Tubul-ligation No Sham surgery Yes Female Vulpes vulpes Foxes NA Wild Yes Adult (toothwear) NA 4 NA 115 0.7860 0.8500 0.955 NA NA NA Survival rate (%) 2 years NA NA NA NA NA NA NA NA 14 20 22 Included as not controlled as effect of sham surgery was assessed on a neighouring site although the authors compare survivalship rates between NA NA Vulpes_vulpes mortality 133
140 Collins and Kasbohn 2017 No Ovariectomy Yes untreated No Female Equus ferus Feral horse NA Wild Yes Adult NA 4 NA 116 0.8610 0.8510 0.900 NA NA NA Survival rate (%) Annual NA NA NA NA NA NA NA NA 114 36 10 There is also male data but they used a lot of different methods, mainly vasectomy and chemical castration, and data is not split according to surgery type NA NA Equus_ferus mortality 134
141 Urfer et al 2020 No Castration Yes Intact (no surgery) No Male Canis lupus Dogs NA Various No Various NA NA NA 117 15.0000 15.2000 14.100 NA NA NA Median survival time Years Confidence interval (calcualted SD) 17.598000 16.530000 20.090000 NA NA NA NA 2115 8567 1551 Calculated SD looks high? Another MSL from age 5 years is provided by not sure of the sample size included NA NA Canis_lupus longevity 135
142 Urfer et al 2020 No Ovariectomy Yes Intact (no surgery) No Male Canis lupus Dogs NA Various No Various NA NA NA 118 14.1000 15.8000 15.000 NA NA NA Median survival time Years Confidence interval (calcualted SD) 20.090000 16.670000 17.598000 NA NA NA NA 1551 8711 2115 Calculated SD looks high? Another MSL from age 5 years is provided by not sure of the sample size included NA NA Canis_lupus longevity 136
143 Ossewaarde et al 2005 No Hysterectomy No Intact (no surgery) No Female Homo sapiens Humans NA NA No Various NA NA NA 119 0.7825 0.8197 NA NA NA NA Survival rate (%) Mean 17 years NA NA NA NA NA NA NA NA 10087 743 NA Taken from number of cases of mortality across the follow-up period (Table 3) NA NA Homo_sapiens mortality 137
144 Ossewaarde et al 2005 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No Various NA NA NA 119 0.7825 0.8139 NA NA NA NA Survival rate (%) Mean 17 years NA NA NA NA NA NA NA NA 10087 865 NA Taken from number of cases of mortality across the follow-up period (Table 3) NA NA Homo_sapiens mortality 138
145 Hotchkiss 1995 Yes Ovariectomy Yes Sham surgery Yes Female Rattus norvegicus Rats Sprague-Dawley Laboratory No 90 days Adult 4 NA 120 0.3330 0.8330 NA NA NA NA Survival rate (%) to 630 days NA NA NA NA NA NA NA NA 12 12 NA Survival to 630 days. Animals that presented with subquaneous tumors had these surgically removed. NA NA Rattus_norvegicus mortality 139
146 Rocca et al 2006 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No Under 45 years old Adult 4 NA 121 0.8380 0.7340 NA NA NA NA Survival rate (%) Not sure, but total follow up years is provided in tables NA NA NA NA NA NA NA NA 1417 124 NA Data from Table 1 and includes all individuals in that bracket NA NA Homo_sapiens mortality 140
147 Rocca et al 2006 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No NA Adult 4 NA 122 0.6280 0.6910 NA NA NA NA Survival rate (%) Not sure, but total follow up years is provided in tables NA NA NA NA NA NA NA NA 645 243 NA Data from Table 1 and includes all individuals in that bracket NA NA Homo_sapiens mortality 141
148 Rocca et al 2006 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No NA Adult 4 NA 123 0.5050 0.5530 NA NA NA NA Survival rate (%) Not sure, but total follow up years is provided in tables NA NA NA NA NA NA NA NA 321 170 NA Data from Table 1 and includes all individuals in that bracket NA NA Homo_sapiens mortality 142
149 Howard et al 2005 No Hysterectomy No Intact (no surgery) No Female Homo sapiens Humans NA NA No NA Adult 4 NA 124 0.9790 0.9770 NA NA NA NA Survival rate (%) NA NA NA NA NA NA NA NA NA 52976 18687 NA Total sample size split between groups is shown in "age at screening", which equates to the total sample size given at start of results. Calculated mortality by adding all causes together. Not sure have calculated this correctly or why it differs so dramatically from % annual that is given NA NA Homo_sapiens mortality 143
150 Howard et al 2005 No Ovariectomy Yes Intact (no surgery) No Female Homo sapiens Humans NA NA No NA Adult 4 NA 124 0.9790 0.9760 NA NA NA NA Survival rate (%) NA NA NA NA NA NA NA NA NA 52976 18251 NA Total sample size split between groups is shown in "age at screening", which equates to the total sample size given at start of results. Calculated mortality by adding all causes together. Not sure have calculated this correctly or why it differs so dramatically from % annual that is given NA NA Homo_sapiens mortality 144
151 Phelan 1995 Yes Ovariectomy Yes Sham surgery Yes Female Mus musculus Mice Swiss Laboratory No Weaning Weaning 2 NA 125 0.4100 0.6200 NA NA NA NA Survival rate (%) To 800 days NA NA NA NA NA NA NA NA 30 30 NA Animals were maintained on a 90% of adlibitum diet. This was a control group for a sepeate CR study and they state stopped the animals getting fat. NA NA Mus_musculus mortality 145
152 Manson et al 2013 No Hysterectomy No Intact (no surgery) No Female Homo sapiens Humans NA NA No Various Adult 4 NA 126 0.9706 0.9449 NA NA NA NA Survival rate (%) 17 years NA NA NA NA NA NA NA NA 8102 5429 NA The control and hysterectomy data is taken from the placebo of two parrellel studies run by the WHI. Women in both studies were matched for age and various variables, although some differences between the cohorts were present as would be typical. NA NA Homo_sapiens mortality 146
153 Deleuze et al 2021 No Tubectomy No Intact (no surgery) No Female Macaca fascicularis Long-tailed Macaques NA NA Yes Adult (most) and a few subadult NA 4 NA 127 0.8600 0.8700 NA NA NA NA Survival rate (%) 3 years NA NA NA NA NA NA NA NA 22 39 NA 2017-2018 cohort. Authors sent me additional data for control female animals that had been marked, and were tracked over the same time period from the same population. NA NA Macaca_fascicularis mortality 147
154 Deleuze et al 2021 No Tubectomy No Intact (no surgery) No Female Macaca fascicularis Long-tailed Macaques NA NA Yes Adult (most) and a few subadult NA 4 NA 128 0.9300 0.9500 NA NA NA NA Survival rate (%) Annual NA NA NA NA NA NA NA NA 41 43 NA 2018-2019 cohort. Authors sent me additional data for control female animals that had been marked, and were tracked over the same time period from the same population. NA NA Macaca_fascicularis mortality 148
155 Deleuze et al 2021 No Tubectomy No Intact (no surgery) No Female Macaca fascicularis Long-tailed Macaques NA NA Yes Adult (most) and a few subadult NA 4 NA 129 0.9500 0.9800 NA NA NA NA Survival rate (%) Annual NA NA NA NA NA NA NA NA 134 45 NA 2019-2020 cohort. Authors sent me additional data for control female animals that had been marked, and were tracked over the same time period from the same population. NA NA Macaca_fascicularis mortality 149
156 Wang et al 2021 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice C57BL6 NA No 8 months Adult 4 NA 130 933.5000 938.5000 NA NA NA NA Median NA SD 129.000000 117.000000 NA NA NA NA NA 22 22 NA Extended figure 3I NA NA Mus_musculus longevity 150
157 Wang et al 2021 Yes Castration Yes Sham surgery Yes Male Mus musculus Mice NA NA No 18 months Adult 4 NA 131 974.0000 959.0000 NA NA NA NA Median NA SD 95.000000 93.000000 NA NA NA NA NA 19 19 NA Fig 6q Animals had been injected with a control shRNA NA NA Mus_musculus longevity 151
158 Tidiere 2016 No Various NA Intact (no surgery) No Female Varecia rubra Red ruffed lemur NA Zoo No Unknown Unknown NA NA 132 15.6500 19.8400 16.180 NA NA NA Mean NA SD 12.454792 10.210810 13.436925 NA NA NA NA 689 67 927 Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species NA NA Varecia_rubra longevity 152
159 Tidiere 2016 No Various NA Intact (no surgery) No Male Varecia rubra Red ruffed lemur NA Zoo No Unknown Unknown NA NA 133 16.1800 19.4000 15.650 NA NA NA Mean NA SD 13.436925 11.495374 12.454792 NA NA NA NA 927 38 689 Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species NA NA Varecia_rubra longevity 153
160 Tidiere 2016 No Various NA Intact (no surgery) No Female Varecia variegata Black and white ruffed lemur NA Zoo No Unknown Unknown NA NA 134 13.9500 18.0300 13.820 NA NA NA Mean NA SD 13.122827 12.489796 14.485185 NA NA NA NA 1542 36 1999 Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species NA NA Varecia_variegata longevity 154
161 Tidiere 2016 No Various NA Intact (no surgery) No Male Varecia variegata Black and white ruffed lemur NA Zoo No Unknown Unknown NA NA 134 13.8200 15.8600 13.950 NA NA NA Mean NA SD 14.485185 12.320698 13.122827 NA NA NA NA 1999 37 1542 Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species NA NA Varecia_variegata longevity 155
162 Larsen1969 Yes Gonadectomy Yes Intact (no surgery) No Female Lamperta fluviatilis River Lamprey NA Lab but wild caught No Prior to sexual maturity - Jan NA 2 NA 135 0.1000 0.3000 NA NA NA NA Survival rate (%) May (after spawning) NA NA NA NA NA NA NA NA 10 10 10 Data extracted from Figures 6D in Larsen 1973 (thesis) and the published abstract. Have calculated survival rate compared to when there is only one control animal alive so we can calculate a log-response ratio. Data is given as the number of gonadectomized animals that survived past the die-off. From figures 3 and 4 of the thesis there is no gonadectomized animal that dies over April when the last of the control males and females died, so we can be confident that the proportion of alive and dead of control and gonadectomized is correct. NA NA Lamperta_fluviatilis mortality 156
163 Larsen1969 Yes Gonadectomy Yes Intact (no surgery) No Male Lamperta fluviatilis River Lamprey NA Lab but wild caught No Prior to sexual maturity - Jan NA 2 NA 136 0.1000 0.2700 NA NA NA NA Survival rate (%) May (after spawning) NA NA NA NA NA NA NA NA 10 11 10 Data extracted from Figures 6D in Larsen 1973 (thesis) and the published abstract. Have calculated survival rate compared to when there is only one control animal alive so we can calculate a log-response ratio. Data is given as the number of gonadectomized animals that survived past the die-off. From figures 3 and 4 of the thesis there is no gonadectomized animal that dies over April when the last of the control males and females died, so we can be confident that the proportion of alive and dead of control and gonadectomized is correct NA NA Lamperta_fluviatilis mortality 157
164 Larsen 1973 Yes Gonadectomy Yes Intact (no surgery) No Female Lamperta fluviatilis River Lamprey NA Lab but wild caught No Prior to sexual maturity - Either Jan or October prior year NA 2 NA 137 0.0600 0.2500 NA NA NA NA Survival rate (%) May (after spawning) NA NA NA NA NA NA NA NA 17 20 50 Data extracted from Figures 6E in Lrsden 1973 (thesis). Sample sizes at the start are in Table 11. Have calculated survival rate compared to when there is only one control animal alive so we can calculate a log-response ratio. Data is given as the number of gonadectomized animals that survived past the die-off. From figures 3 and 4 of the thesis there is no gonadectomized animal that dies over April when the last of the control males and females died, so we can be confident that the proportion of alive and dead of control and gonadectomized is correct NA NA Lamperta_fluviatilis mortality 158
165 Larsen 1973 Yes Gonadectomy Yes Intact (no surgery) No Male Lamperta fluviatilis River Lamprey NA Lab but wild caught No Prior to sexual maturity - Either Jan or October prior year NA 2 NA 138 0.0200 0.2500 NA NA NA NA Survival rate (%) May (after spawning) NA NA NA NA NA NA NA NA 50 20 17 Data extracted from Figures 6E in Lrsden 1973 (thesis). Sample sizes at the start are in Table 12, pooled for the two treatment times. Sample size for the controls comes from fig 4 where heart weight is given just for the same year cohort and sample.sizes are shown. It is started that they have studied approximately 200 animals over the 4 years and never seen a control live much past spawning but this gives a definitive value for that year. Have calculated survival rate compared to when there is only one control animal alive so we can calculate a log-response ratio. Data is given as the number of gonadectomized animals that survived past the die-off. From figures 3 and 4 of the thesis there is no gonadectomized animal that dies over April when the last of the control males and females died, so we can be confident that the proportion of alive and dead of control and gonadectomized is correct NA NA Lamperta_fluviatilis mortality 159
Code
# let's get CVs

dat %>% group_by(Study) %>% summarise(cv2_cont = mean((Error_control_SD/Control_lifespan_variable)^2, na.rm = T), cv2_trt = mean((Error_experimental_SD/Treatment_lifespan_variable)^2, na.rm = T), cv2_opst = mean((Error_opposite_sex_SD/Opposite_sex_lifespan_variable)^2, na.rm = T), n_cont = mean(Sample_size_control, na.rm = T), n_trt =  mean(Sample_size_sterilization, na.rm = T), n_opst =  mean(Sample_size_opposite_sex, na.rm = T)) %>% 
  ungroup() %>% 
  summarise(cv2_cont = weighted.mean(cv2_cont, n_cont, na.rm = T), cv2_trt = weighted.mean(cv2_trt, n_trt, na.rm = T), cv2_opst = weighted.mean(cv2_opst, n_opst, na.rm = T)) -> cvs

# lnRR

# survival proportion using arcsin transformation = lnrrp
# using CV
dat$yi <- ifelse(effect_type == "longevity", lnrrm(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[1]], lnrrp(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control)[[1]])

dat$vi <- ifelse(effect_type == "longevity", lnrrm(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[2]], lnrrp(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control)[[2]])

# here vi2 is the same as vi1
dat$vi2 <- ifelse(effect_type2 == "missing", lnrrm(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[2]], 
                  ifelse(effect_type2 == "longevity", 
                  lnrrm2(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, dat$Error_control_SD, dat$Error_experimental_SD)[[2]],                                                                         lnrrp(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization,dat$Sample_size_control)[[2]]))

# survival transformation using -1/log(p)
# first transform - just to 
pos <- which(dat$Treatment_lifespan_variable == 1)
Treatment_lifespan_variable2 <- replace(dat$Treatment_lifespan_variable, pos, 0.99)
dat$Treatment_lifespan_variable2 <-Treatment_lifespan_variable2

dat$y2 <- ifelse(effect_type == "longevity", lnrrm(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[1]], lnrre(dat$Treatment_lifespan_variable2, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control)[[1]])

dat$v2 <- ifelse(effect_type == "longevity", lnrrm(dat$Treatment_lifespan_variable, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[2]], lnrre(dat$Treatment_lifespan_variable2, dat$Control_lifespan_variable, dat$Sample_size_sterilization, dat$Sample_size_control)[[2]])



# getting effect size for the long format 
# we create a longer data format

dat1 <- dat
dat2 <- dat

dat1$yi <- ifelse(effect_type == "longevity", 
                  lnrrm(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable,  
                        dat$Sample_size_control, dat$Sample_size_opposite_sex, 
                        cvs[["cv2_cont"]],cvs[["cv2_opst"]])[[1]], 
                  lnrrp(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
                        dat$Sample_size_control,  dat$Sample_size_opposite_sex)[[1]])

dat1$vi <-ifelse(effect_type == "longevity", 
                 lnrrm(dat$Control_lifespan_variable,dat$Opposite_sex_lifespan_variable,  
                       dat$Sample_size_control, dat$Sample_size_opposite_sex, 
                       cvs[["cv2_cont"]],cvs[["cv2_opst"]])[[2]], 
                 lnrrp(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
                       dat$Sample_size_control,  dat$Sample_size_opposite_sex)[[2]])

# dat1$y2 <- ifelse(effect_type == "longevity", 
#                   lnrrm(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable,  
#                         dat$Sample_size_control, dat$Sample_size_opposite_sex, 
#                         cvs[["cv2_cont"]],cvs[["cv2_opst"]])[[1]], 
#                   lnrre(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
#                         dat$Sample_size_control,  dat$Sample_size_opposite_sex)[[1]])
# 
# dat1$v2 <-ifelse(effect_type == "longevity", 
#                  lnrrm(dat$Control_lifespan_variable,dat$Opposite_sex_lifespan_variable,  
#                        dat$Sample_size_control, dat$Sample_size_opposite_sex, 
#                        cvs[["cv2_cont"]],cvs[["cv2_opst"]])[[2]], 
#                  lnrre(dat$Control_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
#                        dat$Sample_size_control,  dat$Sample_size_opposite_sex)[[2]])

# here we create CM/F or CF/M
dat2$yi <- ifelse(effect_type == "longevity", 
                  lnrrm(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable,
                        dat$Sample_size_sterilization, dat$Sample_size_opposite_sex, 
                        cvs[["cv2_trt"]],cvs[["cv2_opst"]])[[1]], 
                  lnrrp(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
                        dat$Sample_size_sterilization, dat$Sample_size_opposite_sex)[[1]])

dat2$vi <- ifelse(effect_type == "longevity", 
                  lnrrm(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable,
                        dat$Sample_size_sterilization, dat$Sample_size_opposite_sex, 
                        cvs[["cv2_trt"]],cvs[["cv2_opst"]])[[2]], 
                  lnrrp(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
                        dat$Sample_size_sterilization, dat$Sample_size_opposite_sex)[[2]])

# 
# dat2$y2 <- ifelse(effect_type == "longevity", 
#                   lnrrm(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable,
#                         dat$Sample_size_sterilization, dat$Sample_size_opposite_sex, 
#                         cvs[["cv2_trt"]],cvs[["cv2_opst"]])[[1]], 
#                   lnrre(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
#                         dat$Sample_size_sterilization, dat$Sample_size_opposite_sex)[[1]])
# 
# dat2$v2 <- ifelse(effect_type == "longevity", 
#                   lnrrm(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable,
#                         dat$Sample_size_sterilization, dat$Sample_size_opposite_sex, 
#                         cvs[["cv2_trt"]],cvs[["cv2_opst"]])[[2]], 
#                   lnrre(dat$Treatment_lifespan_variable, dat$Opposite_sex_lifespan_variable, 
#                         dat$Sample_size_sterilization, dat$Sample_size_opposite_sex)[[2]])

# putting two data frames
dat_long <- rbind(dat1, dat2)

# putt 2 new column

dat_long$Obs <- factor(1:dim(dat_long)[[1]])
dat_long$Comp_type <- as.factor(rep(c("both_normal", "one_castrated"), each = dim(dat_long)[[1]]/2))

dat_long$Comp_type_Sex <- paste(dat_long$Comp_type, dat_long$Sex, sep = "_")

dat_long$yi <- ifelse(dat_long$Comp_type_Sex ==  "one_castrated_Female" | dat_long$Comp_type_Sex == "both_normal_Female", -1*dat_long$yi, dat_long$yi)

dat_long %>% filter(!is.na(yi), !is.na(vi)) -> dat_long

#dim(dat_long)

This data is a subset of the main data only including data from rodents. This is used to test the effect of sterilization/castration on life stage (for these species, we were able to get more fine scale data). This dataset has two more variables: 1) Age_at_treatment (age in days when treatment was applied) and 2) Day_to_maturity (age in days when animals become mature). As also mentioned below, the analyses associated with this data set is post-hoc (not planned before data collection).

Code
#sdat <- read_csv(here("data", "data2_15022022.csv"), na = c("", "NA")) 
rdat <- read_csv(here("data",  "literature","data3_05052022.csv"), na = c("", "NA")) 

rdat <- rdat %>% filter(is.na(Treatment_lifespan_variable) == FALSE) %>% 
  #filter(Type_of_sterilization != "Vasectomy") %>% 
  mutate_if(is.character, as.factor) 

#dim(rdat)

# separating two kinds

effect_type_r <- ifelse(str_detect(rdat$Lifespan_parameter, "Me"), "longevity", "mortality")


# effect-level ID
#dat$Species_Latin <- gsub("Macaca Fascicularis", "Macaca fascicularis", dat$Species_Latin) #fix a typo in species name
rdat$Effect_ID <- 1:nrow(rdat)
rdat$Phylogeny <- sub(" ", "_",  rdat$Species_Latin)
rdat$Effect_type <- effect_type_r

# key variables
#names(rdat)
#unique(rdat$Species_Latin)

kable(rdat, "html") %>% 
  kable_styling("striped", position = "left") %>% 
  scroll_box(width = "100%", 
    height = "250px")
Order_extracted Study Controlled_treatments Type_of_sterilization Gonads_removed Control_treatment Sex Day_to_matuarity Species_Latin Species Strain Environment Wild_or_semi_wild Age_at_treatment Age_at_treatment_continuous Maturity_at_treatment Maturity_at_treatment_ordinal Duration_of_treatment Shared_control Control_lifespan_variable Treatment_lifespan_variable Opposite_sex_lifespan_variable Error_control Error_experimental Error_opposite_sex Lifespan_parameter Lifespan_unit Error_unit Error_control_SD Error_experimental_SD Error_opposite_sex_SD Coefficent_difference_to_control Lower_interval Upper_interval Coefficent_unit Sample_size_control Sample_size_sterilization Sample_size_opposite_sex Notes Effect_ID Phylogeny Effect_type
13 Zakeri et al 2019 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice NMRI Laboratory No 10 months 304.0 Adult (old) 4 NA 11 0.360 0.500 NA NA NA NA Survival rate (%) 11.5 months NA NA NA NA NA NA NA NA 16 16 NA Its the sterilization treatment that is compared to two different types of control in this study 1 Mus_musculus mortality
14 Zakeri et al 2019 Yes Ovariectomy Yes Sham surgery Female 42 Mus musculus Mice NMRI Laboratory No 10 months 304.0 Adult (old) 4 NA 11 0.330 0.500 NA NA NA NA Survival rate (%) 11.5 months NA NA NA NA NA NA NA NA 16 16 NA Its the sterilization treatment that is compared to two different types of control in this study 2 Mus_musculus mortality
15 Dorner 1973 Yes Castration Yes Untreated Male 70 Rattus norvegicus Rats Sprague-Dawley-Stammes Laboratory No Day after birth 2.0 Birth 1 NA 12 570.000 696.000 NA 122.00 132.00 NA Mean days Standard Deviation 122.00000 132.00000 NA NA NA NA NA 12 8 NA NA 3 Rattus_norvegicus longevity
16 Asdell et al 1967 Yes Ovariectomy Yes Intact (no surgery) Female 90 Rattus norvegicus Rats Cornell Nutrion colony Laboratory No Between 38-42 days 40.0 Puberty 3 NA 13 742.000 669.000 615 24.00 26.00 21.00 Mean days S.E.M 169.70563 183.84776 148.49242 NA NA NA NA 50 50 50 Also data for mated females but havent included as would be a different environment (e.g. With males) 4 Rattus_norvegicus longevity
17 Asdell et al 1967 Yes Castration Yes Intact (no surgery) Male 70 Rattus norvegicus Rats Cornell Nutrion colony Laboratory No Between 39-42 days 41.0 Puberty 3 NA 14 615.000 651.000 742 21.00 26.00 24.00 Mean days S.E.M 148.49242 183.84776 169.70563 NA NA NA NA 50 50 50 NA 5 Rattus_norvegicus longevity
18 Asdell and Joshi 1976 Yes Ovariectomy Yes Intact (no surgery) Female 90 Rattus norvegicus Rats Manor-Wistar Laboratory No 45 days old 45.0 Puberty 3 NA 15 654.000 844.000 661 24.00 24.00 30.00 Mean days S.E.M 169.70563 169.70563 212.13203 NA NA NA NA 50 50 50 NA 6 Rattus_norvegicus longevity
19 Asdell and Joshi 1976 Yes Castration Yes Intact (no surgery) Male 70 Rattus norvegicus Rats Manor-Wistar Laboratory No 45 days old 45.0 Puberty 3 NA 16 661.000 775.000 654 30.00 30.00 24.00 Mean days S.E.M 212.13203 212.13203 169.70563 NA NA NA NA 50 50 50 NA 7 Rattus_norvegicus longevity
20 Arriola Apelo et al 2020 Yes Castration Yes Sham surgery Male 42 Mus musculus Mice C57BL6 Laboratory No 21 days 21.0 Prepuberty 2 NA 17 1006.000 978.000 853 34.30 37.45 26.25 Median days S.E.M 145.52258 183.46678 136.39900 NA NA NA NA 18 24 27 NA 8 Mus_musculus longevity
21 Arriola Apelo et al 2020 Yes Ovariectomy Yes Sham surgery Female 42 Mus musculus Mice C57BL6 Laboratory No 21 days 21.0 Prepuberty 2 NA 18 853.000 916.000 1006 26.25 49.36 34.30 Median days S.E.M 136.39900 231.51892 145.52258 NA NA NA NA 27 22 18 NA 9 Mus_musculus longevity
22 Benedusi et al 2015 Yes Castration Yes Sham surgery Male 42 Mus musculus Mice C57BL76 (ERE-LucRepTOP™) Laboratory No 5 Months 152.0 Adult (old) 4 NA 19 0.100 0.350 NA NA NA NA Survival rate (%) 15 Months NA NA NA NA NA NA NA NA 20 20 NA NA 10 Mus_musculus mortality
24 Cargil et al 2003 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice CBA Laboratory No 21 days 21.0 Prepuberty 2 NA 21 599.290 578.640 NA 30.45 35.60 NA Median Days S.E.M 158.22284 178.00000 NA NA NA NA NA 27 25 NA Extracted median lifespan from data in figure and calculated SD 11 Mus_musculus longevity
31 Drori and Folman 1976 Yes Castration Yes Intact (no surgery) Male 42 Rattus norvegicus Rats Albino Laboratory No 38-44 days. Stated as prepuberty 41.0 Prepuberty 2 NA 27 727.000 817.000 849 26.00 32.00 26.00 Mean Days S.E.M 182.00000 224.00000 182.00000 NA NA NA NA 49 49 49 Authors state that they castrated animals shortly before puberty, so coded as prepuberty 12 Rattus_norvegicus longevity
32 Garratt et al 2021 Yes Castration Yes Sham surgery Male 70 Mus musculus Mice C57BL6 Laboratory No 7-8 weeks 53.0 Adult (young) 4 NA 28 952.000 960.000 956 20.70 36.40 28.50 Median Days S.E.M 117.09688 218.40000 156.10093 NA NA NA NA 32 36 30 NA 13 Mus_musculus longevity
42 Holland et al 1977 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice RFM Laboratory No 3-4 weeks 25.0 Prepuberty 2 NA 34 638.000 628.000 NA 16.00 16.00 NA Mean Days S.E.M 167.04490 162.38226 NA NA NA NA NA 109 103 NA Just used data from non-irradiated group. Lots of pathology data 14 Mus_musculus longevity
45 Sichuk 1965 Yes Castration Yes Sham surgery Male 48 Mesocricetus auratus Hampsters Syrian Hampsters Laboratory No 6 weeks 42.0 Puberty 3 NA 37 612.000 578.000 589 NA NA NA Mean Days NA 222.91000 151.30000 222.95000 NA NA NA NA 92 90 94 Use - SD from Kirkman & Yau;Error not provided. Mean lifespan comes from the lifespan of both those with thrumobis and those that do not have it. Calculated the mean of these two values weighed against the sample size of each group 15 Mesocricetus_auratus longevity
46 Sichuk 1965 Yes Ovariectomy Yes Sham surgery Female 48 Mesocricetus auratus Hampsters Syrian Hampsters Laboratory No 6 weeks 42.0 Puberty 3 NA 38 589.000 586.000 612 NA NA NA Mean Days NA 222.95000 155.44000 222.91000 NA NA NA NA 94 92 92 Use - SD from Kirkman & Yau;Error not provided. Mean lifespan comes from the lifespan of both those with thrumobis and those that do not have it. Calculated the mean of these two values weighed against the sample size of each group 16 Mesocricetus_auratus longevity
51 Slonaker 1930 Yes Castration Yes Intact (no surgery) Male 70 Rattus norvegicus Rats Albino Laboratory No 44 days. Testes had decended by the operation 44.0 Adult (young) 4 NA 43 788.000 770.000 863 22.25 28.00 27.69 Mean Days Probable error 32.98740 41.51223 41.05263 NA NA NA NA 10 8 17 NA 17 Rattus_norvegicus longevity
52 Slonaker 1930 Yes Vasectomy No Intact (no surgery) Male 70 Rattus norvegicus Rats Albino Laboratory No 46.5 days. Testes had decended by the operation 47.0 Adult (young) 4 NA 43 788.000 685.000 863 22.25 39.72 27.69 Mean Days Probable error 32.98740 58.88807 41.05263 NA NA NA NA 10 12 17 Standard deviation calculated from probable error as P.E./0.6745. Calculation derived from P.E. Wikipedia page 18 Rattus_norvegicus longevity
53 Slonaker 1930 Yes Ovariectomy Yes Intact (no surgery) Female 90 Rattus norvegicus Rats Albino Laboratory No 27.5 days 28.0 Prepuberty 2 NA 44 863.000 755.000 788 27.69 22.15 22.25 Mean Days Probable error 41.05263 32.83914 32.98740 NA NA NA NA 17 37 10 NA 19 Rattus_norvegicus longevity
54 Slonaker 1930 Yes Hysterectomy No Intact (no surgery) Female 90 Rattus norvegicus Rats Albino Laboratory No 29 days 29.0 Prepuberty 2 NA 44 863.000 855.000 788 27.69 12.67 22.25 Mean Days Probable error 41.05263 18.78428 32.98740 NA NA NA NA 17 60 10 NA 20 Rattus_norvegicus longevity
55 Storer et al 1982 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice RFM Laboratory No 50 days 50.0 Adult (young) 4 NA 45 643.400 662.200 NA 5.91 7.31 NA Mean Days S.E.M. 161.31161 134.19376 NA NA NA NA NA 745 337 NA Non-irradiated controls from an irradiation experiment 21 Mus_musculus longevity
56 Storer et al 1982 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice Balb/c Laboratory No 50 days 50.0 Adult (young) 4 NA 46 762.900 795.500 NA 6.21 10.95 NA Mean Days S.E.M. 179.01611 197.70740 NA NA NA NA NA 831 326 NA Non-irradiated controls from an irradiation experiment 22 Mus_musculus longevity
61 Mason et al 2009 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice CBA Laboratory No 21 days 21.0 Prepuberty 2 NA 51 727.600 715.000 NA 15.90 20.00 NA Mean Days S.E.M 89.94398 101.98039 NA NA NA NA NA 32 26 NA Worked out sample size from fig 4 This and the other entry for this paper have two different control comparisons 23 Mus_musculus longevity
62 Mason et al 2009 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice CBA Laboratory No 21 days 21.0 Prepuberty 2 NA 51 725.600 715.000 NA 20.40 20.00 NA Mean Days S.E.M 117.18908 101.98039 NA NA NA NA NA 33 26 NA Worked out sample size from fig 4 24 Mus_musculus longevity
63 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Male 70 Rattus norvegicus Rats Lewis Laboratory No Birth 1.0 Birth 1 NA 52 454.000 521.000 484 18.00 27.00 19.00 Mean Days S.E.M 108.00000 174.98000 123.13407 NA NA NA NA 36 42 42 NA 25 Rattus_norvegicus longevity
64 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Male 70 Rattus norvegicus Rats Lewis Laboratory No 22-28 days 25.0 Prepuberty 2 NA 52 454.000 488.000 484 18.00 28.00 19.00 Mean Days S.E.M 108.00000 165.65023 123.13407 NA NA NA NA 36 35 42 NA 26 Rattus_norvegicus longevity
65 Talbert and Hamilton 1965 Yes Castration Yes Sham surgery Male 70 Rattus norvegicus Rats Lewis Laboratory No 100 days 100.0 Adult (young) 4 NA 52 454.000 439.000 484 18.00 25.00 19.00 Mean Days S.E.M 108.00000 119.89579 123.13407 NA NA NA NA 36 23 42 NA 27 Rattus_norvegicus longevity
66 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Lewis Laboratory No Birth 1.0 Birth 1 NA 53 484.000 574.000 454 19.00 33.00 18.00 Mean Days S.E.M 123.13407 183.73622 108.00000 NA NA NA NA 42 31 36 NA 28 Rattus_norvegicus longevity
67 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Lewis Laboratory No 22-28 days 25.0 Prepuberty 2 NA 53 484.000 480.000 454 19.00 44.00 18.00 Mean Days S.E.M 123.13407 206.37829 108.00000 NA NA NA NA 42 22 36 NA 29 Rattus_norvegicus longevity
68 Talbert and Hamilton 1965 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Lewis Laboratory No 100 days 100.0 Adult (young) 4 NA 53 484.000 515.000 454 19.00 41.00 18.00 Mean Days S.E.M 123.13407 183.35757 108.00000 NA NA NA NA 42 20 36 NA 30 Rattus_norvegicus longevity
94 Muhlock 1959 Yes Castration Yes Intact (no surgery) Male 42 Mus musculus Mice DBA Laboratory No Weaning (1month) 30.0 Prepuberty 2 NA 75 578.000 595.000 667 10.12 11.44 9.57 Mean days S.E.M 78.38918 102.32247 88.74853 NA NA NA NA 60 80 86 Extracted data and calculated mean and SE from graph 31 Mus_musculus longevity
95 Muhlock 1959 Yes Ovariectomy Yes Intact (no surgery) Female 42 Mus musculus Mice DBA Laboratory No Weaning (1 month) 30.0 Prepuberty 2 NA 76 667.000 627.000 578 9.57 10.67 10.12 Mean days S.E.M 88.74853 87.98707 78.38918 NA NA NA NA 86 68 60 Extracted data and calculated mean and SE from graph 32 Mus_musculus longevity
99 Iwasa et al 2018 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Sprague-Dawley Laboratory No 23 weeks 161.0 Late adult 4 NA 80 0.430 0.860 NA NA NA NA Survival rate (%) ~85 weeks. NA NA NA NA NA NA NA NA 8 7 NA Calculated from a partial survival curve. Looked at when 50% of the control group died and then the number alive in the treatment group at this point 33 Rattus_norvegicus mortality
114 Cheng 2019 Yes Castration Yes Sham surgery Male 42 Mus musculus Mice UMHet3 Laboratory No Under 30 days 17.5 Prepuberty 2 NA 91 0.810 0.970 NA NA NA NA Survival rate (%) 500 days NA NA NA NA NA NA NA NA 238 238 NA NA 34 Mus_musculus mortality
132 Sato et al 1997 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Sprague-Dawley Laboratory No 9 months 274.0 Adult 4 NA 109 0.800 0.971 NA NA NA NA Survival rate (%) 6 months NA NA NA NA NA NA NA NA 35 35 NA NA 35 Rattus_norvegicus mortality
135 Pullinger and Head 1964 Yes Ovariectomy Yes untreated Female 42 Mus musculus Mice C3Hf Laboratory No 56-111 days of age 84.0 Adult 4 NA 112 0.370 0.230 NA NA NA NA Survival rate (%) to 30 months NA NA NA NA NA NA NA NA 114 40 NA "average lifespan" in months is also provided but no error. Calculated the percentage surviving to 30 months as dead ranges are provided in 6 brackets and this is the closest to the median for control females. This group is control virgin females (OVX data was shared and compared to breeding females in the other female comparison for this paper but I removed it because I dont think social environment was comparable) 36 Mus_musculus mortality
145 Hotchkiss 1995 Yes Ovariectomy Yes Sham surgery Female 90 Rattus norvegicus Rats Sprague-Dawley Laboratory No 90 days 90.0 Adult 4 NA 120 0.333 0.833 NA NA NA NA Survival rate (%) to 630 days NA NA NA NA NA NA NA NA 12 12 NA Survival to 630 days. Animals that presented with subquaneous tumors had these surgically removed. 37 Rattus_norvegicus mortality
151 Phelan 1995 Yes Ovariectomy Yes Sham surgery Female 42 Mus musculus Mice Swiss Laboratory No Weaning 25.0 Weaning 2 NA 125 0.410 0.620 NA NA NA NA Survival rate (%) To 800 days NA NA NA NA NA NA NA NA 30 30 NA Animals were maintained on a 90% of adlibitum diet. This was a control group for a sepeate CR study and they state stopped the animals getting fat. 38 Mus_musculus mortality
156 Wang et al 2021 Yes Castration Yes Sham surgery Male 42 Mus musculus Mice C57BL6 NA No 8 months 243.0 Adult 4 NA 130 933.500 938.500 NA NA NA NA Median NA SD 129.00000 117.00000 NA NA NA NA NA 22 22 NA Extended figure 3I 39 Mus_musculus longevity
157 Wang et al 2021 Yes Castration Yes Sham surgery Male 42 Mus musculus Mice NA NA No 18 months 548.0 Adult 4 NA 131 974.000 959.000 NA NA NA NA Median NA SD 95.00000 93.00000 NA NA NA NA NA 19 19 NA Fig 6q Animals had been injected with a control shRNA 40 Mus_musculus longevity
Code
# let's get CVs

rdat %>% group_by(Study) %>% summarise(cv2_cont = mean((Error_control_SD/Control_lifespan_variable)^2, na.rm = T), cv2_trt = mean((Error_experimental_SD/Treatment_lifespan_variable)^2, na.rm = T), cv2_opst = mean((Error_opposite_sex_SD/Opposite_sex_lifespan_variable)^2, na.rm = T), n_cont = mean(Sample_size_control, na.rm = T), n_trt =  mean(Sample_size_sterilization, na.rm = T), n_opst =  mean(Sample_size_opposite_sex, na.rm = T)) %>% 
  ungroup() %>% 
  summarise(cv2_cont = weighted.mean(cv2_cont, n_cont, na.rm = T), cv2_trt = weighted.mean(cv2_trt, n_trt, na.rm = T), cv2_opst = weighted.mean(cv2_opst, n_opst, na.rm = T)) -> cvs

# lnRR
# using CV
rdat$yi <- ifelse(effect_type_r == "longevity", lnrrm(rdat$Treatment_lifespan_variable, rdat$Control_lifespan_variable, rdat$Sample_size_sterilization, rdat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[1]], lnrrp(rdat$Treatment_lifespan_variable, rdat$Control_lifespan_variable, rdat$Sample_size_sterilization, rdat$Sample_size_control)[[1]])

rdat$vi <- ifelse(effect_type_r == "longevity", lnrrm(rdat$Treatment_lifespan_variable, rdat$Control_lifespan_variable, rdat$Sample_size_sterilization, rdat$Sample_size_control, cvs[["cv2_trt"]],cvs[["cv2_cont"]])[[2]], lnrrp(rdat$Treatment_lifespan_variable, rdat$Control_lifespan_variable, rdat$Sample_size_sterilization, rdat$Sample_size_control)[[2]])

#str(rdat)

This dataset is a part of the full data and only has data from rodent species.

This data sets is a subset of the main data and this includes only study which has all 4 groups: 1) control females, 2) control males, 3) treated females and 4) treated males.

Code
#sdat <- read_csv(here("data", "data2_15022022.csv"), na = c("", "NA")) 
sdat <- read_csv(here("data", "literature", "data2_19042022.csv"), na = c("", "NA")) 
effect_type_s <- ifelse(str_detect(sdat$Lifespan_parameter, "Me"), "longevity", "mortality")


# effect-level ID

sdat$Effect_ID <- 1:nrow(sdat)
sdat$Phylogeny <- sub(" ", "_",  sdat$Species_Latin)
sdat$Effect_type <- effect_type_s

kable(sdat, "html") %>% 
  kable_styling("striped", position = "left") %>% 
  scroll_box(width = "100%", 
    height = "250px")
Order_extracted Study Controlled_treatments Wild_or_semi_wild Type_of_sterilization Gonads_removed Control_treatment Species_Latin Species Strain Environment Age_at_treatment Shared_control Male_control_lifespan_variable Error_male_control_SD Sample_size_male_control Male_sterilization_lifespan_variable Error_male_sterilization_SD Sample_size_male_sterilization Female_control_lifespan_variable Error_female_control_SD Sample_size_female_control Female_sterilization_lifespan_variable Error_female_sterilization_SD Sample_size_female_sterilization Lifespan_parameter Lifespan_unit Notes Effect_ID Phylogeny Effect_type
20 Arriola Apelo et al 2020 Yes No Castration Yes Sham surgery Mus musculus Mice C57BL6 Laboratory 21 days 17 1006.00 145.522576 18 978.00 171.617460 24 853.00 136.399001 27 916.00 203.516494 22 Median days NA 1 Mus_musculus longevity
19 Asdell and Joshi 1976 Yes No Castration Yes Intact (no surgery) Rattus norvegicus Rat Manor-Wistar Laboratory 45 days old 16 661.00 212.132034 50 775.00 212.132034 50 654.00 169.705627 50 844.00 169.705627 50 Mean days NA 2 Rattus_norvegicus longevity
17 Asdell et al 1967 Yes No Castration Yes Intact (no surgery) Rattus norvegicus Rat Cornell Nutrion colony Laboratory Between 38-42 days 14 615.00 148.492424 50 651.00 183.847763 50 742.00 169.705627 50 669.00 183.847763 50 Mean days NA 3 Rattus_norvegicus longevity
115 Bronson 1981 No No Castration Yes Intact (no surgery) Felis catus Cats Various breeds Domestic Various 92 4.97 3.660000 219 7.34 4.290000 265 6.65 5.660000 99 9.11 5.130000 220 Mean Years - for cats surviving to two years old Lifespan of individuals calculated from histograms. Used data from animals that survived after the first year. 4 Felis_catus longevity
117 Bronson 1982 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 94 8.00 5.200000 755 9.90 6.800000 54 7.70 4.400000 224 8.80 6.900000 528 Mean (from those alive after 2) Years Mean lifespan is that of those that are alive from 2 years of age. The authors also provide lifespan from birth, but point out that animals are not usually sterilized until at least 6 months, so this doesnt provide a fair comparison 5 Canis_lupus longevity
72 Hamilton 1965 No No Castration Yes Intact (no surgery) Felis catus Cats Various breeds Domestic Before 1 year 57 3.20 2.741168 65 6.80 4.492661 60 7.70 5.178726 58 9.20 4.656522 28 Mean Years Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. 6 Felis_catus longevity
74 Hamilton 1965 No No Castration Yes Intact (no surgery) Felis catus Cats Various breeds Domestic Before 1 year 59 6.10 4.713343 51 8.50 4.913980 77 7.40 5.091169 50 8.40 4.762825 45 Mean Years Error displayed must be standard error not standard deviation. I initially interpreted the symbol used as standard deviation but actually it must be SEM, and this is what Hamilton usually uses. Otherwise they are abnormally low. 7 Felis_catus longevity
33 Hamilton et al 1969 No No Castration Yes Intact (no surgery) Felis catus Cats Outbred Domestic Various 29 5.30 4.136520 97 8.10 4.820332 201 7.70 4.794163 85 8.20 4.503332 75 Mean Years Pooled data for all ages which is consistent for both castrated and spayed of both sexes. 8 Felis_catus longevity
38 Hamilton et al 1969 No No Castration Yes Intact (no surgery) Felis catus Cats Name breeds Domestic Various, median 6 months 32 4.60 3.500000 25 6.90 4.971428 71 6.20 5.040000 36 8.20 4.723071 34 Mean Years NA 9 Felis_catus longevity
57 Hoffman et al 2018 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 47 10.86 3.327386 915 11.64 2.033618 844 10.86 3.685485 693 12.12 5.766116 921 Mean Years Vetcompass database 10 Canis_lupus longevity
59 Hoffman et al 2018 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 49 8.00 8.556337 14941 9.21 4.241509 11244 7.68 6.018372 7392 9.73 5.599714 19598 Mean Years VMDB - individual data for breeds available in supplementary, but just mean lifespan without error 11 Canis_lupus longevity
76 Huang et al 2017 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 61 9.00 5.941000 839 12.00 3.723000 332 10.00 5.947000 528 12.00 3.938000 607 Median Years Interquartile range Intact, 5.0-13.0; castrated 9.0-14.0 12 Canis_lupus longevity
43 Kirkman and Yau No No Castration Yes Intact (no surgery) Mesocricetus auratus Hampsters Syrian Hampsters Laboratory Unknown - not given 35 632.00 222.910000 629 508.00 151.300000 72 543.00 222.950000 578 391.00 155.440000 31 Mean Days Do not have error presented in paper. The proportion of animals dying in 10 brackets of different ages is presented that could be used (Figs 3 and 4). Upper and low quartiles estimated from figure 3 when number of animals dying in 100 day periods is given. Have used the middle number within this period for the quartile value (e.g. 550-850 for intact males, 350-550 for castrated males) 13 Mesocricetus_auratus longevity
47 Mitchel et al 1999 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 39 131.00 50.029192 1277 128.00 46.058550 291 130.00 51.951131 833 144.00 40.249224 720 Mean Months Used all causes of death. Data collected on the basis of surveys that pet owners filled out about their last pets age at death 14 Canis_lupus longevity
94 Muhlock 1959 Yes No Castration Yes Intact (no surgery) Mus musculus Mouse DBA Laboratory Weaning 75 578.00 78.389183 60 595.00 102.322471 80 667.00 88.748529 86 627.00 87.987074 68 Mean days Extracted data and calculated mean and SE from graph 15 Mus_musculus longevity
105 Oneil et al 2013 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 83 11.99 NA 1464 11.99 NA 1224 11.59 NA 1082 12.39 NA 1304 Mean Years Means calculated from the coefficient change in lifespan in Table 4. Sample size for all was known, SD was estimated 16 Canis_lupus longevity
107 Oneil et al 2015 No No Castration Yes Intact (no surgery) Felis catus Cats Various breeds Domestic Various 85 12.81 NA 704 14.71 NA 1296 14.61 NA 707 15.21 NA 1302 Mean Years Means calculated from the coefficient change in lifespan in Table 4. Sample size for each sex was estimated on the basis of the total sample size and the percentage that were known to be sterilized in both sexes, SD was estimated 17 Felis_catus longevity
30 Reedy et al 2016 Yes Yes Castration Yes Sham surgery Anolis sagrei Anole lizards NA Wild Unknown - wild caught 26 0.55 NA 60 0.28 NA 60 0.25 NA 110 0.21 NA 110 Survival rate (%) 10 weeks (of breeding season) NA 18 Anolis_sagrei mortality
45 Sichuk 1965 Yes No Castration Yes Sham surgery Mesocricetus auratus Hampsters Syrian Hampsters Laboratory 6 weeks 37 612.00 222.910000 92 578.00 151.300000 90 589.00 222.950000 94 586.00 155.440000 92 Mean Days Use - SD from Kirkman & Yau;Error not provided. Mean lifespan comes from the lifespan of both those with thrumobis and those that do not have it. Calculated the mean of these two values weighed against the sample size of each group 19 Mesocricetus_auratus longevity
51 Slonaker 1929 Yes No Castration Yes Intact (no surgery) Rattus norvegicus Rat Albino Laboratory 44 days 43 788.00 32.987398 10 770.00 41.512231 8 863.00 41.052632 17 855.00 18.784285 60 Mean Days Hyesterectomy female comparison 20 Rattus_norvegicus longevity
51 Slonaker 1929 Yes No Castration Yes Intact (no surgery) Rattus norvegicus Rat Albino Laboratory 44 days 43 788.00 32.987398 10 770.00 41.512231 8 863.00 41.052632 17 755.00 32.839140 37 Mean Days Ovariectomy female comparison 21 Rattus_norvegicus longevity
63 Talbert and Hamilton 1965 Yes No Castration Yes Sham surgery Rattus norvegicus Rats Lewis Laboratory Birth 52 454.00 108.000000 36 521.00 174.979999 42 484.00 123.134073 42 574.00 183.736224 31 Mean Days NA 22 Rattus_norvegicus longevity
64 Talbert and Hamilton 1965 Yes No Castration Yes Sham surgery Rattus norvegicus Rats Lewis Laboratory 22-28 days 52 454.00 108.000000 36 488.00 165.650234 35 484.00 123.134073 42 480.00 206.378293 22 Mean Days NA 23 Rattus_norvegicus longevity
65 Talbert and Hamilton 1965 Yes No Castration Yes Sham surgery Rattus norvegicus Rats Lewis Laboratory 100 days 52 454.00 108.000000 36 439.00 119.895788 23 484.00 123.134073 42 515.00 183.357574 20 Mean Days NA 24 Rattus_norvegicus longevity
87 Urfer et al 2019 No No Castration Yes Intact (no surgery) Canis lupus Dogs Various breeds Domestic Various 68 14.09 18.753700 322958 14.15 12.400487 909894 13.77 22.107487 230974 14.35 9.710121 906252 Median years 95% confidence intervals Intact Male: 14.03-14.16; Castrated male: 14.13-14.18 25 Canis_lupus longevity
159 Tidiere 2016 No No Unknown Unknown Intact (no surgery) Varecia rubra Red ruffed lemur NA Zoo Unknown 133 16.18 13.436925 927 19.40 11.495374 38 15.65 12.454792 689 19.84 10.210810 67 Mean Years Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species 26 Varecia_rubra longevity
161 Tidiere 2016 No No Unknown Unknown Intact (no surgery) Varecia variegata Black and white ruffed lemur NA Zoo Unknown 134 13.82 14.485185 1999 15.86 12.320698 37 13.95 13.122827 1542 18.03 12.489796 36 Mean Years Data as described in Fig 7.3 of thesis, from 1 year of age and split for each species 27 Varecia_variegata longevity
129 Kent et al 2018 No No Castration Yes Intact (no surgery) Canis lupus Dogs Golden retriver Domestic Unknown 106 8.68 3.230000 118 9.35 2.710000 228 5.89 3.270000 58 9.51 2.740000 248 Median Years Standard deviation calculated from the range according to Wan et al 2014 28 Canis_lupus longevity
136 Robertson et al 1961 No No Castration Yes untreated Oncorhynchus nerka Kokanee salmon NA Experimental pond 2 years 1 month 113 4.05 0.590000 41 5.31 1.600000 13 4.26 0.550000 58 5.89 1.630000 16 Mean Years Only used data on animals that were found dead and did not have regenerating gonads. Mortality data is presented for a larger cohort that were also exposed to predation but control data is not seperated according to sex. 29 Oncorhynchus_nerka longevity
141 Urfer et al 2020 No No Castration Yes Intact (no surgery) Canis lupus Dogs NA Various Various 117 15.00 17.598000 2115 15.20 16.530000 8567 14.10 20.090000 1551 15.80 16.670000 8711 Median survival time Years Calculated SD looks high? Another MSL from age 5 years is provided by not sure of the sample size included 30 Canis_lupus longevity
162 Larsen1969 Yes No Gonadectomy Yes Intact (no surgery) Lamperta fluviatilis River Lamprey NA Lab but wild caught Prior to sexual maturity - Jan 135 0.10 NA 10 0.27 NA 10 0.10 NA 10 0.30 NA 10 Survival rate (%) May (after spawning) Data extracted from Figures 6D in Larsen 1973 (thesis) and the published abstract 31 Lamperta_fluviatilis mortality
164 Larsen 1973 Yes No Gonadectomy Yes Intact (no surgery) Lamperta fluviatilis River Lamprey NA Lab but wild caught Prior to sexual maturity - Either Jan or October prior year 137 0.02 NA 50 0.25 NA 20 0.06 NA 17 0.25 NA 20 Survival rate (%) May (after spawning) Data extracted from Figures 6E in Lrsden 1973 (thesis). Sample sizes at the start are in Table 11 32 Lamperta_fluviatilis mortality
Code
# we create a longer data format

sdat1 <- sdat
sdat2 <- sdat
# lnRR

# here we create the ratio of M/F
sdat1$yi <- ifelse(effect_type_s == "longevity", 
                  lnrrm(sdat$Male_control_lifespan_variable, sdat$Female_control_lifespan_variable,
                        sdat$Sample_size_male_control, sdat$Sample_size_female_control, 
                        cvs[["cv2_cont"]],cvs[["cv2_cont"]])[[1]], 
                  lnrrp(sdat$Male_control_lifespan_variable, sdat$Female_control_lifespan_variable, 
                        sdat$Sample_size_male_control,  sdat$Sample_size_female_control)[[1]])

sdat1$vi <- ifelse(effect_type_s == "longevity", 
                  lnrrm(sdat$Male_control_lifespan_variable, sdat$Female_control_lifespan_variable,
                        sdat$Sample_size_male_control, sdat$Sample_size_female_control, 
                        cvs[["cv2_cont"]],cvs[["cv2_cont"]])[[2]], 
                  lnrrp(sdat$Male_control_lifespan_variable, sdat$Female_control_lifespan_variable, 
                        sdat$Sample_size_male_control,  sdat$Sample_size_female_control)[[2]])

# here we create CM/CF
sdat2$yi <- ifelse(effect_type_s == "longevity", 
                  lnrrm(sdat$Male_sterilization_lifespan_variable, sdat$Female_sterilization_lifespan_variable,
                        sdat$Sample_size_male_sterilization, sdat$Sample_size_female_sterilization, 
                        cvs[["cv2_trt"]],cvs[["cv2_trt"]])[[1]], 
                  lnrrp(sdat$Male_sterilization_lifespan_variable, sdat$Female_sterilization_lifespan_variable, 
                        sdat$Sample_size_male_sterilization,  sdat$Sample_size_female_sterilization)[[1]])

sdat2$vi <-  ifelse(effect_type_s == "longevity", 
                   lnrrm(sdat$Male_sterilization_lifespan_variable, sdat$Female_sterilization_lifespan_variable,
                         sdat$Sample_size_male_sterilization, sdat$Sample_size_female_sterilization, 
                         cvs[["cv2_trt"]],cvs[["cv2_trt"]])[[2]], 
                   lnrrp(sdat$Male_sterilization_lifespan_variable, sdat$Female_sterilization_lifespan_variable, 
                         sdat$Sample_size_male_sterilization,  sdat$Sample_size_female_sterilization)[[2]])

# merging sdata frames
sdat_long <- rbind(sdat1, sdat2)

# putt 2 new column

sdat_long$Obs <- factor(1:dim(sdat_long)[[1]])
sdat_long$Comp_type <- as.factor(rep(c("both_normal", "both_castrated"), each = dim(sdat_long)[[1]]/2))
Code
#sdat <- read_csv(here("data", "data2_15022022.csv"), na = c("", "NA")) 
mdat <- read_csv(here("data", "literature", "data_meta-data.csv")) 


kable(mdat, "html") %>% 
  kable_styling("striped", position = "left") %>% 
  scroll_box(width = "100%", 
    height = "250px")
Order_extracted Serial number of the order of effect size extration
Study Study data was taken from
Controlled_treatments Whether treatment allocation and environments were derived in a controlled way
Type_of_sterilization Type of sterilization used
Gonads_removed Whether gonads were removed as part of the sterilization
Control_treatment Type of treatment/sham manipulation applied to controls
Shamtreatment_moderator Whether control groups involved sham treatments or not
Sex Sex in which the effect of sterilization was assessed
Species_Latin Latin name of species
Species Common name
Strain Strain of animal used where relevant
Environment Type of environment that effects were assessed in
Wild_or_semi_wild Whether the environment was wild/semi-wild or not
Age_at_treatment Information on age at which sterilization was conducted
Maturity_at_treatment When sterilization was conducted in relation to life stage
Maturity_at_treatment_ordinal When sterilization was conducted as an ordinal variable (1=birth; 2 = pre-puberty, 3 = puberty, 4 = adulthood)
Duration_of_treatment Duration of treatment if not permanent
Shared_control Shared numbers denote that a shared control or treatment group was used in each of these comparisons
Control_lifespan_variable Lifespan/survival variable for the control group
Treatment_lifespan_variable Lifespan/survival variable for the sterilized group
Opposite_sex_lifespan_variable Lifespan/survival variable for the opposite sex group if available
Error_control Error value for control group as extracted from the original source
Error_experimental Error value for sterilized group as extracted from the original source
Error_opposite_sex Error value for opposite sex group as extracted from the original source
Lifespan_parameter Type of survival data
Lifespan_unit Unit of measurement for survival data
Error_unit Unit of measurement for error in original source
Error_control_SD Standard deviation of control group
Error_experimental_SD Standard deviation of sterilized group
Error_opposite_sex_SD Standard deviation of opposite sex group
Coefficent_difference_to_control Coefficient estimate of difference to control group in lifespan from original source
Lower_interval Lower confidence interval for coefficient estimate
Upper_interval Upper confidence interval for coefficient estimate
Coefficent_unit Unit of measurement for coefficient estimate
Sample_size_control Sample size of control group
Sample_size_sterilization Sample size of sterilization group
Sample_size_opposite_sex Sample size of opposite sex group
Notes Notes on study and data extraction

4 Summarise the dataset

Visualise missing data in 6 key variables (moderators): - Sex, - Wild_or_semi_wild, - Maturity_at_treatment_ordinal, - Gonads_removed, - Controlled_treatments, - Effect_type

Alluvial diagrams for key predictor variables (moderators) - two groups of 3 moderators, grouped by similarity:

0 in Mautraity class is NA

Code
#use ggalluvial (https://cran.r-project.org/web/packages/ggalluvial/vignettes/ggalluvial.html)

# create a frequency table for first 3 moderator variables
# freq_1 <- as.data.frame(table(dat$Sex, dat$Gonads_removed, dat$Maturity_at_treatment_ordinal)) %>% rename(Sex = Var1, Gonads_removed = Var2, Maturity_at_treatment_ordinal = Var3)
# is_alluvia_form(as.data.frame(freq_1), axes = 1:3, silent = TRUE)
# #freq_1 %>% filter(Freq != 0) %>% arrange(desc(Freq)) #collapesd table of values, without 0s

 
# ggplot(data = freq_1,
#   aes(axis1 = Sex, axis2 = Gonads_removed, axis3 = Maturity_at_treatment_ordinal, y = Freq)) +
#   geom_alluvium(aes(fill = Sex)) +
#   geom_stratum(aes(fill = Sex))+
#   geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
# #theme_minimal() +
#   theme_void() +
#   theme(legend.position = "none",
#         plot.title = element_text(hjust = 0.5, vjust = 3),
#         axis.title.x = element_text(),
#         axis.text.x = element_text(face="bold")) +
#   scale_x_discrete(limits = c("Sex", "Gonads removed", "Maturity class"), expand = c(0.15, 0.05), position = "top") +
#   scale_fill_brewer(palette = "Set3") +
#   ggtitle("A. Subjects sex, manipulation type and maturity class")

#as above but with, but with Gonads_removed as first column, and different colours
# ggplot(data = freq_1,
#   aes(axis1 = Gonads_removed, axis2 = Sex, axis3 = Maturity_at_treatment_ordinal, y = Freq)) +
#   geom_alluvium(aes(fill = Gonads_removed)) +
#   geom_stratum(aes(fill = Gonads_removed))+
#   geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
#   theme_minimal() +
# #  theme_void() +
#   theme(legend.position = "none",
#         plot.title = element_text(hjust = 0.5, vjust = 3),
#         axis.title.x = element_text(),
#         axis.text.x = element_text(face="bold")) +
#   scale_x_discrete(limits = c("Gonads_removed", "Sex", "Maturity class"), expand = c(0.15, 0.05), position = "top") +
#   scale_fill_brewer(palette = "Pastel2") +
#   ggtitle("A. Subjects sex, manipulation and maturity ")

#NOTE: all rows with NA in Maturity class are removed from the plot 
#recode NA as 0
dat$Maturity_at_treatment_ordinal2 <- dat$Maturity_at_treatment_ordinal
dat$Maturity_at_treatment_ordinal2[is.na(dat$Maturity_at_treatment_ordinal2)] <- 0
# create a frequency table for first 3 moderator variables
freq_1 <- as.data.frame(table(dat$Sex, dat$Gonads_removed, dat$Maturity_at_treatment_ordinal2)) %>% rename(Sex = Var1, Gonads_removed = Var2, Maturity_at_treatment_ordinal = Var3)
is_alluvia_form(as.data.frame(freq_1), axes = 1:3, silent = TRUE)
#freq_1 %>% filter(Freq != 0) %>% arrange(desc(Freq)) #collapesd table of values, without 0s

 
# ggplot(data = freq_1,
#   aes(axis1 = Sex, axis2 = Gonads_removed, axis3 = Maturity_at_treatment_ordinal, y = Freq)) +
#   geom_alluvium(aes(fill = Sex)) +
#   geom_stratum(aes(fill = Sex))+
#   geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
# #theme_minimal() +
#   theme_void() +
#   theme(legend.position = "none",
#         plot.title = element_text(hjust = 0.5, vjust = 3),
#         axis.title.x = element_text(),
#         axis.text.x = element_text(face="bold")) +
#   scale_x_discrete(limits = c("Sex", "Gonads removed", "Maturity class"), expand = c(0.15, 0.05), position = "top") +
#   scale_fill_brewer(palette = "Set3") +
#   ggtitle("A. Subjects sex, manipulation type and maturity class")

#as above but with, but with Gonads_removed as first column, and different colours
ggplot(data = freq_1,
  aes(axis1 = Gonads_removed, axis2 = Sex, axis3 = Maturity_at_treatment_ordinal, y = Freq)) +
  geom_alluvium(aes(fill = Gonads_removed)) +
  geom_stratum(aes(fill = Gonads_removed))+
  geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
  theme_minimal() +
#  theme_void() +
  theme(legend.position = "none",
        plot.title = element_text(hjust = 0.5, vjust = 3),
        axis.title.x = element_text(),
        axis.text.x = element_text(face="bold")) +
  scale_x_discrete(limits = c("Gonads_removed", "Sex", "Maturity class"), expand = c(0.15, 0.05), position = "top") +
  scale_fill_brewer(palette = "Pastel2") +
  ggtitle("A. Subjects sex, manipulation and maturity ")

Code
# create a frequency table for next 3 moderator variables
freq_2 <- as.data.frame(table(dat$Wild_or_semi_wild, dat$Controlled_treatments, dat$Effect_type)) %>% rename(Wild_or_semi_wild = Var1, Controlled_treatments = Var2, Effect_type = Var3)
is_alluvia_form(as.data.frame(freq_2), axes = 1:3, silent = TRUE)
#freq_2 %>% filter(Freq != 0) %>% arrange(desc(Freq)) #collapesd table of values, without 0s

ggplot(data = freq_2,
  aes(axis1 = Wild_or_semi_wild, axis2 = Controlled_treatments, axis3 = Effect_type, y = Freq)) +
  geom_alluvium(aes(fill = Wild_or_semi_wild)) +
  geom_stratum(aes(fill = Wild_or_semi_wild))+
  geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
  theme_minimal() +
#  theme_void() +
  theme(legend.position = "none",
        plot.title = element_text(hjust = 0.5, vjust = 3),
        axis.title.x = element_text(),
        axis.text.x = element_text(face="bold")) +
  scale_x_discrete(limits = c("Wild_or_semi_wild", "Controlled_treatments", "Outcome type"), expand = c(0.15, 0.05), position = "top") +
  scale_fill_brewer(palette = "Pastel1") +
  ggtitle("B. Experimental settings and outcome type")

Code
#names(dat_key)
Code
# create a frequency table for next 3 moderator variables
freq_3 <- as.data.frame(table(dat$Gonads_removed, dat$Wild_or_semi_wild, dat$Effect_type)) %>% rename(Gonads_removed = Var1, Wild_or_semi_wild = Var2, Effect_type = Var3)
is_alluvia_form(as.data.frame(freq_3), axes = 1:3, silent = TRUE)
#freq_2 %>% filter(Freq != 0) %>% arrange(desc(Freq)) #collapesd table of values, without 0s

ggplot(data = freq_3,
  aes(axis1 = Gonads_removed, axis2 = Wild_or_semi_wild, axis3 = Effect_type, y = Freq)) +
  geom_alluvium(aes(fill = Gonads_removed)) +
  geom_stratum(aes(fill = Gonads_removed))+
  geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
  theme_minimal() +
#  theme_void() +
  theme(legend.position = "none",
        plot.title = element_text(hjust = 0.5, vjust = 3),
        axis.title.x = element_text(),
        axis.text.x = element_text(face="bold")) +
  scale_x_discrete(limits = c("Gonads_removed", "Wild_or_semi_wild", "Outcome type"), expand = c(0.15, 0.05), position = "top") +
  scale_fill_brewer(palette = "Set3") +
  ggtitle("C. Manipulation, subject and outcome types")

Code
#names(dat_key)

This just shows a different combination of predictor variables (moderators) from plots A and B.

5 Building phylogenetic tree

Code
#names(dat)
myspecies <- as.character(unique(dat$Species_Latin)) #get list of species
#str_sort(myspecies) #visual check
#length(myspecies) #23 species
#length(unique(myspecies)) #23 unique species names

Using rotl package to retrieve synthetic species tree from Open Tree of Life: Rotl is an R package (https://peerj.com/preprints/1471/) allowing access to synthetic phylogenetic tree available at Open Tree of Life database (https://opentreeoflife.org/).

Code
taxa <- tnrs_match_names(names = myspecies)
dim(taxa) #40 specias - all matched
table(taxa$approximate_match) #1 approximate match
taxa[taxa$approximate_match == TRUE, ] ##lamperta fluviatilis (search_string) will be presented as Perca fluviatilis (uniquw_name)
Code
tree <- tol_induced_subtree(ott_ids = taxa[["ott_id"]], label_format = "name")  
# plot(tree, cex=.6, label.offset =.1, no.margin = TRUE) visual check
Code
#check overlap and differences with the taxa list
intersect(gsub("_"," ", tree$tip.label), myspecies) #22
setdiff(gsub("_"," ", tree$tip.label), myspecies) # "Perca fluviatilis"  
setdiff(myspecies, gsub("_"," ", tree$tip.label)) # "Lamperta fluviatilis"
tree$tip.label <- gsub("Perca_fluviatilis", "Lamperta_fluviatilis", tree$tip.label) #replace with the original name

#tree <- drop.tip(tree, "Equus_caballus")
#re-check overlap and differences with myspecies list
#intersect(myspecies, tree2$tip.label) #23
#setdiff(myspecies, tree2$tip.label) #0
#setdiff(tree2$tip.label, myspecies) #0

#check if the tree is really binary 
is.binary.tree(tree) #TRUE
# tree_binary$node.label <- NULL #you can delete internal node labels
# *NOTE:* no branch lengths are included, they can be created later via simulations.  

write.tree(tree, file=here("data", "tree_rotl.tre")) #save the tree

# *NOTE:* underscores within species names on tree tip labals are added automatically
# tree <- read.tree(file="plot_cooked_fish_MA.tre") #if you need to read in the tree
# tree$tip.label <- gsub("_"," ", tree$tip.label) #get rid of the underscores
# tree$node.label <- NULL #you can delete internal node labels
Code
tree <- read.tree(here("data", "literature","tree_rotl.tre"))

plot(tree, cex=.6, label.offset =.1, no.margin = TRUE)

Code
# #or plot to pdf
# pdf(here("figs/rotl_tree.pdf"), width=8, heigh=10)
# plot(tree, cex=0.6, label.offset =.1, no.margin = TRUE)
# dev.off()

6 Meta-analysis: main

Code
# VCV matrix to model shared control 
V_matrix <- impute_covariance_matrix(vi = dat$vi, cluster = dat$Shared_control, r = 0.5)

# phylogeny to model
#tree <- read.tree(here("data/tree_rotl.tre"))
tree <- compute.brlen(tree)

cor_tree <- vcv(tree, corr = TRUE)

# checking the match
#match(unique(dat$Phylogeny), colnames(cor_tree))


# meta-analysis basics
# phylogenetic model
mod <-  rma.mv(yi, V = V_matrix, mod = ~ 1, 
               random = list(~1|Phylogeny, 
                             ~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               R = list(Phylogeny = cor_tree), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(mod) 

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.5192  -33.0384  -23.0384   -7.7254  -22.6436   

Variance Components:

            estim    sqrt  nlvls  fixed         factor    R 
sigma^2.1  0.0011  0.0325     22     no      Phylogeny  yes 
sigma^2.2  0.0166  0.1289     22     no  Species_Latin   no 
sigma^2.3  0.0133  0.1152     71     no          Study   no 
sigma^2.4  0.0080  0.0894    159     no      Effect_ID   no 

Test for Heterogeneity:
Q(df = 158) = 1366.5635, p-val < .0001

Model Results:

estimate      se    tval   df    pval   ci.lb   ci.ub      
  0.1636  0.0428  3.8232  158  0.0002  0.0791  0.2481  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod),2) # almost no phylogenetic effect
        I2_Total     I2_Phylogeny I2_Species_Latin         I2_Study 
           99.41             2.70            42.43            33.89 
    I2_Effect_ID 
           20.39 
Code
# visualizing the result
orchard_plot(mod, xlab = "log response ratio (lnRR)", group = "Study")

Code
# reduced model without phylogeny 
# alternative


mod2 <-  rma.mv(yi, V = V_matrix, mod = ~ 1, 
               random = list(#~1|Phylogeny, 
                             ~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               #R = list(Phylogeny = cor_tree), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(mod2) 

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.5131  -33.0262  -25.0262  -12.7758  -24.7648   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0172  0.1310     22     no  Species_Latin 
sigma^2.2  0.0132  0.1149     71     no          Study 
sigma^2.3  0.0080  0.0894    159     no      Effect_ID 

Test for Heterogeneity:
Q(df = 158) = 1366.5635, p-val < .0001

Model Results:

estimate      se    tval   df    pval   ci.lb   ci.ub      
  0.1589  0.0383  4.1529  158  <.0001  0.0833  0.2345  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# we will not use robust for the analysis - they do not seem to change the results
# rob2.2 <- robust(mod2, cluster = Study, adjust=TRUE, clubSandwich=TRUE, verbose=TRUE)
# rob2.2

anova(mod, mod2) # they are not significantly different

        df      AIC      BIC     AICc  logLik    LRT   pval        QE 
Full     5 -23.0384  -7.7254 -22.6436 16.5192               1366.5635 
Reduced  4 -25.0262 -12.7758 -24.7648 16.5131 0.0122 0.9122 1366.5635 
Code
# using alternative effect size: -1/ln(p)

V_matrix2 <- impute_covariance_matrix(vi = dat$v2, cluster = dat$Shared_control, r = 0.5)

#
mod_alt <-  rma.mv(y2, V = V_matrix2, mod = ~ 1, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(mod_alt) 

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
-72.7948  145.5896  153.5896  165.8400  153.8511   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0394  0.1985     22     no  Species_Latin 
sigma^2.2  0.0137  0.1168     71     no          Study 
sigma^2.3  0.0025  0.0502    159     no      Effect_ID 

Test for Heterogeneity:
Q(df = 158) = 676.1277, p-val < .0001

Model Results:

estimate      se    tval   df    pval   ci.lb   ci.ub      
  0.2384  0.0602  3.9625  158  0.0001  0.1196  0.3573  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_alt),2) # almost no phylogenetic effect
        I2_Total I2_Species_Latin         I2_Study     I2_Effect_ID 
           98.06            69.52            24.09             4.45 
Code
# visualizing the result
orchard_plot(mod_alt, xlab = "log response ratio (lnRR)", group = "Study")

7 Meta-regression: non-full models

Code
# no phylogeny

mod_func <-  function(formula) {
        rma.mv(yi, 
               V = V_matrix,
               mod = formula, 
               random = list(#~1|Phylogeny, 
                             ~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
                            #optmethod="BFGS")
               )
}
Code
mod_sex <- mod_func(formula = ~ Sex-1)
summary(mod_sex)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 15.8527  -31.7053  -21.7053   -6.4241  -21.3080   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0170  0.1305     22     no  Species_Latin 
sigma^2.2  0.0132  0.1150     71     no          Study 
sigma^2.3  0.0082  0.0908    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1356.6488, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 8.6421, p-val = 0.0003

Model Results:

           estimate      se    tval   df    pval   ci.lb   ci.ub      
SexFemale    0.1581  0.0400  3.9528  157  0.0001  0.0791  0.2371  *** 
SexMale      0.1603  0.0441  3.6310  157  0.0004  0.0731  0.2475  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_sex1 <- mod_func(formula = ~ Sex)
summary(mod_sex1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 15.8527  -31.7053  -21.7053   -6.4241  -21.3080   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0170  0.1305     22     no  Species_Latin 
sigma^2.2  0.0132  0.1150     71     no          Study 
sigma^2.3  0.0082  0.0908    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1356.6488, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 0.0041, p-val = 0.9493

Model Results:

         estimate      se    tval   df    pval    ci.lb   ci.ub      
intrcpt    0.1581  0.0400  3.9528  157  0.0001   0.0791  0.2371  *** 
SexMale    0.0022  0.0339  0.0637  157  0.9493  -0.0648  0.0691      

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_sex1)
   R2_marginal R2_conditional 
  2.840973e-05   7.858099e-01 
Code
# orchard plot
#test <- mod_results(mod_sex1, mod = "Sex", group = "Study", data = dat)
p1 <- orchard_plot(mod_sex1, mod = "Sex", 
                   xlab = "log response ratio (lnRR)", 
                   group = "Study",cb = F,
                   angle = 0)

p1

Code
# creating a new variable Sex + Gonad because 

dat$Sex_Gonads <- paste(dat$Sex, dat$Gonads_removed, sep = "_")

dat$Sex_Gonads[grep("NA", dat$Sex_Gonads)] <- NA


dat$Sex_Gonads <- factor(dat$Sex_Gonads, 
       levels = c("Female_No", "Female_Yes", "Male_Yes"),
       labels = c("Gonads removed \n(female)", "Gonads not removed \n(female)", "Gonads removed \n(male)") 
       )


mod_rem <- mod_func(formula = ~ Sex_Gonads-1)
summary(mod_rem)

Multivariate Meta-Analysis Model (k = 155; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 13.3161  -26.6322  -14.6322    3.5111  -14.0528   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0226  0.1502     20     no  Species_Latin 
sigma^2.2  0.0115  0.1073     70     no          Study 
sigma^2.3  0.0092  0.0958    155     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 152) = 1320.7321, p-val < .0001

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 152) = 4.7873, p-val = 0.0032

Model Results:

                                         estimate      se    tval   df    pval 
Sex_GonadsGonads removed \n(female)        0.1345  0.0549  2.4481  152  0.0155 
Sex_GonadsGonads not removed \n(female)    0.1706  0.0493  3.4595  152  0.0007 
Sex_GonadsGonads removed \n(male)          0.1730  0.0506  3.4187  152  0.0008 
                                          ci.lb   ci.ub      
Sex_GonadsGonads removed \n(female)      0.0260  0.2431    * 
Sex_GonadsGonads not removed \n(female)  0.0732  0.2680  *** 
Sex_GonadsGonads removed \n(male)        0.0730  0.2729  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_rem1 <- mod_func(formula = ~ Sex_Gonads)
summary(mod_rem1)

Multivariate Meta-Analysis Model (k = 155; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 13.3161  -26.6322  -14.6322    3.5111  -14.0528   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0226  0.1502     20     no  Species_Latin 
sigma^2.2  0.0115  0.1073     70     no          Study 
sigma^2.3  0.0092  0.0958    155     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 152) = 1320.7321, p-val < .0001

Test of Moderators (coefficients 2:3):
F(df1 = 2, df2 = 152) = 0.2448, p-val = 0.7832

Model Results:

                                         estimate      se    tval   df    pval 
intrcpt                                    0.1345  0.0549  2.4481  152  0.0155 
Sex_GonadsGonads not removed \n(female)    0.0361  0.0540  0.6676  152  0.5054 
Sex_GonadsGonads removed \n(male)          0.0385  0.0585  0.6571  152  0.5121 
                                           ci.lb   ci.ub    
intrcpt                                   0.0260  0.2431  * 
Sex_GonadsGonads not removed \n(female)  -0.0707  0.1428    
Sex_GonadsGonads removed \n(male)        -0.0772  0.1541    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_rem1)
   R2_marginal R2_conditional 
   0.005389222    0.789101671 
Code
# orchard plot
p2 <- orchard_plot(mod_rem, mod = "Sex_Gonads", 
                   xlab = "log response ratio (lnRR)", 
                   group = "Study", cb = F,
                   angle = 0) 

p2

Code
dat$Wild_or_semi_wild <- factor(dat$Wild_or_semi_wild, 
       levels = c("No", "Yes"),
       labels = c("Others \n(e.g., lab, farm)" , "Wild or \nSemi-wild") 
       )


mod_env <- mod_func(formula = ~ Wild_or_semi_wild-1)
summary(mod_env)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 18.2939  -36.5878  -26.5878  -11.3066  -26.1904   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0163  0.1277     22     no  Species_Latin 
sigma^2.2  0.0155  0.1247     71     no          Study 
sigma^2.3  0.0065  0.0808    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1242.5261, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 10.8042, p-val < .0001

Model Results:

                                             estimate      se    tval   df 
Wild_or_semi_wildOthers \n(e.g., lab, farm)    0.1160  0.0434  2.6721  157 
Wild_or_semi_wildWild or \nSemi-wild           0.2379  0.0540  4.4056  157 
                                               pval   ci.lb   ci.ub      
Wild_or_semi_wildOthers \n(e.g., lab, farm)  0.0083  0.0302  0.2017   ** 
Wild_or_semi_wildWild or \nSemi-wild         <.0001  0.1313  0.3446  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_env1 <- mod_func(formula = ~ Wild_or_semi_wild)
summary(mod_env1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 18.2939  -36.5878  -26.5878  -11.3066  -26.1904   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0163  0.1277     22     no  Species_Latin 
sigma^2.2  0.0155  0.1247     71     no          Study 
sigma^2.3  0.0065  0.0808    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1242.5261, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 4.2887, p-val = 0.0400

Model Results:

                                      estimate      se    tval   df    pval 
intrcpt                                 0.1160  0.0434  2.6721  157  0.0083 
Wild_or_semi_wildWild or \nSemi-wild    0.1220  0.0589  2.0709  157  0.0400 
                                       ci.lb   ci.ub     
intrcpt                               0.0302  0.2017  ** 
Wild_or_semi_wildWild or \nSemi-wild  0.0056  0.2383   * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_env1)
   R2_marginal R2_conditional 
    0.06841806     0.84154080 
Code
# orchard plot
p3 <- orchard_plot(mod_env1, mod = "Wild_or_semi_wild", 
                   xlab = "log response ratio (lnRR)", 
                   group = "Study") +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

p3

Code
dat$Controlled_treatments <- factor(dat$Controlled_treatments, 
       levels = c("No", "Yes"),
       labels = c("Not controlled" , "Controlled") 
       )

mod_con <- mod_func(formula = ~ Controlled_treatments-1)
summary(mod_con)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 17.2675  -34.5349  -24.5349   -9.2537  -24.1376   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0181  0.1345     22     no  Species_Latin 
sigma^2.2  0.0120  0.1098     71     no          Study 
sigma^2.3  0.0082  0.0903    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1157.4537, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 9.1744, p-val = 0.0002

Model Results:

                                     estimate      se    tval   df    pval 
Controlled_treatmentsNot controlled    0.1127  0.0559  2.0162  157  0.0455 
Controlled_treatmentsControlled        0.1938  0.0490  3.9554  157  0.0001 
                                      ci.lb   ci.ub      
Controlled_treatmentsNot controlled  0.0023  0.2232    * 
Controlled_treatmentsControlled      0.0970  0.2906  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_con1 <- mod_func(formula = ~ Controlled_treatments)
summary(mod_con1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 17.2675  -34.5349  -24.5349   -9.2537  -24.1376   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0181  0.1345     22     no  Species_Latin 
sigma^2.2  0.0120  0.1098     71     no          Study 
sigma^2.3  0.0082  0.0903    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1157.4537, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 1.3130, p-val = 0.2536

Model Results:

                                 estimate      se    tval   df    pval    ci.lb 
intrcpt                            0.1127  0.0559  2.0162  157  0.0455   0.0023 
Controlled_treatmentsControlled    0.0810  0.0707  1.1459  157  0.2536  -0.0587 
                                  ci.ub    
intrcpt                          0.2232  * 
Controlled_treatmentsControlled  0.2207    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_con1)
   R2_marginal R2_conditional 
    0.04115198     0.79572638 
Code
# orchard plot
p4 <- orchard_plot(mod_con1, mod = "Controlled_treatments", 
                   xlab = "log response ratio (lnRR)",
                   group = "Study") +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

p4

Code
dat$Shamtreatment_moderator <- factor(dat$Shamtreatment_moderator, 
       levels = c("No", "Yes"),
       labels = c("No sham" , "Sham-controlled") 
       )

mod_sham <- mod_func(formula = ~ Shamtreatment_moderator-1)
summary(mod_sham)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.9221  -33.8441  -23.8441   -8.5629  -23.4468   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0240  0.1549     22     no  Species_Latin 
sigma^2.2  0.0111  0.1052     71     no          Study 
sigma^2.3  0.0079  0.0891    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1210.4783, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 8.3174, p-val = 0.0004

Model Results:

                                        estimate      se    tval   df    pval 
Shamtreatment_moderatorNo sham            0.1376  0.0459  2.9957  157  0.0032 
Shamtreatment_moderatorSham-controlled    0.2009  0.0514  3.9071  157  0.0001 
                                         ci.lb   ci.ub      
Shamtreatment_moderatorNo sham          0.0469  0.2283   ** 
Shamtreatment_moderatorSham-controlled  0.0993  0.3024  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_sham1 <- mod_func(formula = ~ Shamtreatment_moderator)
summary(mod_sham1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.9221  -33.8441  -23.8441   -8.5629  -23.4468   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0240  0.1549     22     no  Species_Latin 
sigma^2.2  0.0111  0.1052     71     no          Study 
sigma^2.3  0.0079  0.0891    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1210.4783, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 1.7038, p-val = 0.1937

Model Results:

                                        estimate      se    tval   df    pval 
intrcpt                                   0.1376  0.0459  2.9957  157  0.0032 
Shamtreatment_moderatorSham-controlled    0.0633  0.0485  1.3053  157  0.1937 
                                          ci.lb   ci.ub     
intrcpt                                  0.0469  0.2283  ** 
Shamtreatment_moderatorSham-controlled  -0.0325  0.1590     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_sham1)
   R2_marginal R2_conditional 
    0.01935552     0.81917113 
Code
# orchard plot
p5 <- orchard_plot(mod_sham, mod = "Shamtreatment_moderator", 
             xlab = "log response ratio (lnRR)", 
             group = "Study") +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

p5

Code
dat$Effect_type <- factor(dat$Effect_type, 
       levels = c("longevity", "mortality"),
       labels = c("Mean or meadian \nlongevity" , "Mortality \n(%)") 
       )

mod_eff <- mod_func(formula = ~ Effect_type-1)
summary(mod_eff)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.8833  -33.7665  -23.7665   -8.4853  -23.3692   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0162  0.1271     22     no  Species_Latin 
sigma^2.2  0.0144  0.1202     71     no          Study 
sigma^2.3  0.0079  0.0888    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1201.4085, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 9.2756, p-val = 0.0002

Model Results:

                                        estimate      se    tval   df    pval 
Effect_typeMean or meadian \nlongevity    0.1222  0.0518  2.3584  157  0.0196 
Effect_typeMortality \n(%)                0.1784  0.0425  4.1970  157  <.0001 
                                         ci.lb   ci.ub      
Effect_typeMean or meadian \nlongevity  0.0198  0.2245    * 
Effect_typeMortality \n(%)              0.0944  0.2623  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# contrast
mod_eff1 <- mod_func(formula = ~ Effect_type)
summary(mod_eff1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.8833  -33.7665  -23.7665   -8.4853  -23.3692   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0162  0.1271     22     no  Species_Latin 
sigma^2.2  0.0144  0.1202     71     no          Study 
sigma^2.3  0.0079  0.0888    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1201.4085, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 1.0636, p-val = 0.3040

Model Results:

                            estimate      se    tval   df    pval    ci.lb 
intrcpt                       0.1222  0.0518  2.3584  157  0.0196   0.0198 
Effect_typeMortality \n(%)    0.0562  0.0545  1.0313  157  0.3040  -0.0514 
                             ci.ub    
intrcpt                     0.2245  * 
Effect_typeMortality \n(%)  0.1638    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_eff1)
   R2_marginal R2_conditional 
    0.02020104     0.79927113 
Code
# orchard plot
p6 <- orchard_plot(mod_eff1, mod = "Effect_type", 
             xlab = "log response ratio (lnRR)", 
             group = "Study",cb = F) +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 
p6

Code
mod_effa <- mod_alt1 <-  rma.mv(y2, V = V_matrix2,
              mod = ~ Effect_type-1, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead"))
summary(mod_effa)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
-71.1533  142.3065  152.3065  167.5878  152.7039   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0179  0.1337     22     no  Species_Latin 
sigma^2.2  0.0176  0.1327     71     no          Study 
sigma^2.3  0.0024  0.0492    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 587.4308, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 157) = 12.7018, p-val < .0001

Model Results:

                                        estimate      se    tval   df    pval 
Effect_typeMean or meadian \nlongevity    0.1538  0.0569  2.7030  157  0.0076 
Effect_typeMortality \n(%)                0.3168  0.0674  4.6983  157  <.0001 
                                         ci.lb   ci.ub      
Effect_typeMean or meadian \nlongevity  0.0414  0.2661   ** 
Effect_typeMortality \n(%)              0.1836  0.4500  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
mod_effa1 <- mod_alt1 <-  rma.mv(y2, V = V_matrix2,
              mod = ~ Effect_type, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead"))
summary(mod_effa1)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
-71.1533  142.3065  152.3065  167.5878  152.7039   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0179  0.1337     22     no  Species_Latin 
sigma^2.2  0.0176  0.1327     71     no          Study 
sigma^2.3  0.0024  0.0492    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 587.4308, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 4.2265, p-val = 0.0415

Model Results:

                            estimate      se    tval   df    pval   ci.lb 
intrcpt                       0.1538  0.0569  2.7030  157  0.0076  0.0414 
Effect_typeMortality \n(%)    0.1631  0.0793  2.0559  157  0.0415  0.0064 
                             ci.ub     
intrcpt                     0.2661  ** 
Effect_typeMortality \n(%)  0.3198   * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_effa1)
   R2_marginal R2_conditional 
     0.1498655      0.9456636 
Code
# orchard plot
orchard_plot(mod_effa1, mod = "Effect_type", 
             xlab = "log response ratio (lnRR)", 
             group = "Study",cb = F) +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

Code
mod_mat <- mod_func(formula = ~ Maturity_at_treatment_ordinal)
summary(mod_mat)

Multivariate Meta-Analysis Model (k = 100; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 -1.3998    2.7996   12.7996   25.7244   13.4517   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0134  0.1158     18     no  Species_Latin 
sigma^2.2  0.0294  0.1715     51     no          Study 
sigma^2.3  0.0028  0.0525    100     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 98) = 503.0467, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 98) = 2.2803, p-val = 0.1342

Model Results:

                               estimate      se     tval  df    pval    ci.lb 
intrcpt                          0.3557  0.1076   3.3052  98  0.0013   0.1421 
Maturity_at_treatment_ordinal   -0.0437  0.0289  -1.5101  98  0.1342  -0.1010 
                                ci.ub     
intrcpt                        0.5692  ** 
Maturity_at_treatment_ordinal  0.0137     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_mat)
   R2_marginal R2_conditional 
    0.04342106     0.94205047 
Code
# bubble plot
p7 <- bubble_plot(mod_mat, 
                  xlab = "Life-course stages",
                  ylab = "lnRR (effect size)",
            mod = "Maturity_at_treatment_ordinal", 
            group = "Study", cb = F)

p7

Code
# interaction with Sex
mod_sex_mat <- mod_func(formula = ~ Sex*Maturity_at_treatment_ordinal)
summary(mod_sex_mat)

Multivariate Meta-Analysis Model (k = 100; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  2.2987   -4.5974    9.4026   27.3531   10.6754   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0088  0.0940     18     no  Species_Latin 
sigma^2.2  0.0317  0.1781     51     no          Study 
sigma^2.3  0.0021  0.0454    100     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 96) = 494.5351, p-val < .0001

Test of Moderators (coefficients 2:4):
F(df1 = 3, df2 = 96) = 3.8206, p-val = 0.0124

Model Results:

                                       estimate      se     tval  df    pval 
intrcpt                                  0.0319  0.1681   0.1897  96  0.8500 
SexMale                                  0.4940  0.1948   2.5358  96  0.0128 
Maturity_at_treatment_ordinal            0.0438  0.0442   0.9890  96  0.3251 
SexMale:Maturity_at_treatment_ordinal   -0.1681  0.0572  -2.9397  96  0.0041 
                                         ci.lb    ci.ub     
intrcpt                                -0.3018   0.3655     
SexMale                                 0.1073   0.8807   * 
Maturity_at_treatment_ordinal          -0.0441   0.1316     
SexMale:Maturity_at_treatment_ordinal  -0.2817  -0.0546  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_mat)
   R2_marginal R2_conditional 
    0.04342106     0.94205047 
Code
# different reference (gives whether male slope is significant)
mod_sex_mat1 <- mod_func(formula = ~ relevel(Sex,ref = "Male")*Maturity_at_treatment_ordinal)
summary(mod_sex_mat1)

Multivariate Meta-Analysis Model (k = 100; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  2.2987   -4.5974    9.4026   27.3531   10.6754   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0088  0.0940     18     no  Species_Latin 
sigma^2.2  0.0317  0.1781     51     no          Study 
sigma^2.3  0.0021  0.0454    100     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 96) = 494.5351, p-val < .0001

Test of Moderators (coefficients 2:4):
F(df1 = 3, df2 = 96) = 3.8206, p-val = 0.0124

Model Results:

                                                                estimate 
intrcpt                                                           0.5259 
relevel(Sex, ref = "Male")Female                                 -0.4940 
Maturity_at_treatment_ordinal                                    -0.1244 
relevel(Sex, ref = "Male")Female:Maturity_at_treatment_ordinal    0.1681 
                                                                    se     tval 
intrcpt                                                         0.1240   4.2405 
relevel(Sex, ref = "Male")Female                                0.1948  -2.5358 
Maturity_at_treatment_ordinal                                   0.0394  -3.1576 
relevel(Sex, ref = "Male")Female:Maturity_at_treatment_ordinal  0.0572   2.9397 
                                                                df    pval 
intrcpt                                                         96  <.0001 
relevel(Sex, ref = "Male")Female                                96  0.0128 
Maturity_at_treatment_ordinal                                   96  0.0021 
relevel(Sex, ref = "Male")Female:Maturity_at_treatment_ordinal  96  0.0041 
                                                                  ci.lb 
intrcpt                                                          0.2797 
relevel(Sex, ref = "Male")Female                                -0.8807 
Maturity_at_treatment_ordinal                                   -0.2026 
relevel(Sex, ref = "Male")Female:Maturity_at_treatment_ordinal   0.0546 
                                                                  ci.ub      
intrcpt                                                          0.7720  *** 
relevel(Sex, ref = "Male")Female                                -0.1073    * 
Maturity_at_treatment_ordinal                                   -0.0462   ** 
relevel(Sex, ref = "Male")Female:Maturity_at_treatment_ordinal   0.2817   ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# bubble plot
p8 <- bubble_plot(mod_sex_mat, 
                  xlab = "Life-course stages",
                  ylab = "lnRR (effect size)",
            mod = "Maturity_at_treatment_ordinal", 
            group = "Study", by = "Sex")

p8

8 Meta-regression: full model

Code
# at least 10 in each group (sex * wild = male wild is too few - 4)

mod_full <- mod_func(formula = ~ Sex_Gonads + Sex*Controlled_treatments +  Wild_or_semi_wild + Sex*Maturity_at_treatment_ordinal)
summary(mod_full)

Multivariate Meta-Analysis Model (k = 100; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  1.1461   -2.2921   19.7079   47.4476   23.0079   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0156  0.1248     18     no  Species_Latin 
sigma^2.2  0.0291  0.1706     51     no          Study 
sigma^2.3  0.0027  0.0519    100     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 92) = 367.7087, p-val < .0001

Test of Moderators (coefficients 2:8):
F(df1 = 7, df2 = 92) = 1.6388, p-val = 0.1343

Model Results:

                                         estimate      se     tval  df    pval 
intrcpt                                   -0.0002  0.1932  -0.0013  92  0.9990 
Sex_GonadsGonads not removed \n(female)   -0.0020  0.0468  -0.0435  92  0.9654 
Sex_GonadsGonads removed \n(male)          0.5876  0.2374   2.4746  92  0.0152 
Controlled_treatmentsControlled            0.0390  0.0891   0.4376  92  0.6627 
Wild_or_semi_wildWild or \nSemi-wild      -0.0171  0.1008  -0.1694  92  0.8658 
Maturity_at_treatment_ordinal              0.0500  0.0467   1.0704  92  0.2873 
SexMale:Controlled_treatmentsControlled   -0.1090  0.1379  -0.7904  92  0.4313 
SexMale:Maturity_at_treatment_ordinal     -0.1720  0.0592  -2.9058  92  0.0046 
                                           ci.lb    ci.ub     
intrcpt                                  -0.3839   0.3834     
Sex_GonadsGonads not removed \n(female)  -0.0949   0.0908     
Sex_GonadsGonads removed \n(male)         0.1160   1.0591   * 
Controlled_treatmentsControlled          -0.1379   0.2158     
Wild_or_semi_wildWild or \nSemi-wild     -0.2174   0.1832     
Maturity_at_treatment_ordinal            -0.0428   0.1428     
SexMale:Controlled_treatmentsControlled  -0.3830   0.1649     
SexMale:Maturity_at_treatment_ordinal    -0.2896  -0.0544  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_full)
   R2_marginal R2_conditional 
     0.1331988      0.9507803 
Code
#res_mod_full <- dredge(mod_full, trace=2)
res_mod_full <- dredge(mod_full, trace=2)

saveRDS(res_mod_full, file = here("Rdata", "literature", "res_mod_full.rds"))
Code
res_mod_full <- readRDS(file = here("Rdata","literature", "res_mod_full.rds"))

# delta AIC = 2
res_mod_full2<- subset(res_mod_full, delta <= 2) #, recalc.weights=FALSE)

# the best model according to the delta 2
best2 <- mod_func(formula = ~ Controlled_treatments + Wild_or_semi_wild)
#summary(best2)

# model varaged coeffisents
avg2 <- model.avg(res_mod_full2)
summary(avg2) # similar to the orignal resulde

Call:
model.avg(object = res_mod_full2)

Component model call: 
rma.mv(yi = yi, V = V_matrix, mods = ~<4 unique rhs>, random = list(~1 
     | Species_Latin, ~1 | Study, ~1 | Effect_ID), data = dat, test = t, 
     sparse = TRUE, control = list(optimizer = "optim", optmethod = 
     "Nelder-Mead"))

Component models: 
       df logLik   AICc delta weight
2       5  14.84 -19.28  0.00   0.38
(Null)  4  13.29 -18.32  0.96   0.24
12      6  15.25 -17.95  1.34   0.20
1       5  14.10 -17.80  1.48   0.18

Term codes: 
Controlled_treatments     Wild_or_semi_wild 
                    1                     2 

Model-averaged coefficients:  
(full average) 
                                     Estimate Std. Error z value Pr(>|z|)  
intrcpt                               0.12316    0.05473   2.250   0.0244 *
Wild_or_semi_wildWild or \nSemi-wild  0.06579    0.07279   0.904   0.3661  
Controlled_treatmentsYes              0.02739    0.05755   0.476   0.6341  
 
(conditional average) 
                                     Estimate Std. Error z value Pr(>|z|)  
intrcpt                               0.12316    0.05473   2.250   0.0244 *
Wild_or_semi_wildWild or \nSemi-wild  0.11342    0.06109   1.856   0.0634 .
Controlled_treatmentsYes              0.07219    0.07412   0.974   0.3301  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# note 
# controlling and wild-semi-wide is correlated: r = 0.34
#cor.test(as.numeric(dat$Controlled_treatments),as.numeric(dat$Wild_or_semi_wild))

9 Publication bais & sensitivity analysis

Code
# raw funnel plot
# funnel plot - 
funnel(mod)

Code
# residual funnel plot
funnel(best2)

Code
dat$Effective_N <- 1/dat$Sample_size_sterilization + 1/dat$Sample_size_control

egger_uni <- mod_func(formula = ~ sqrt(Effective_N))
#egger_uni2 <- mod_func(formula = ~ Effective_N)

summary(egger_uni)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 19.6267  -39.2535  -29.2535  -13.9722  -28.8561   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0186  0.1362     22     no  Species_Latin 
sigma^2.2  0.0067  0.0818     71     no          Study 
sigma^2.3  0.0103  0.1017    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1244.6556, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 7.9120, p-val = 0.0055

Model Results:

                   estimate      se    tval   df    pval    ci.lb   ci.ub     
intrcpt              0.0546  0.0525  1.0397  157  0.3001  -0.0491  0.1582     
sqrt(Effective_N)    0.5685  0.2021  2.8128  157  0.0055   0.1693  0.9677  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# 
egger_uni2 <- mod_func(formula = ~ Effective_N)
summary(egger_uni2)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.3751  -40.7503  -30.7503  -15.4691  -30.3529   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0162  0.1272     22     no  Species_Latin 
sigma^2.2  0.0081  0.0902     71     no          Study 
sigma^2.3  0.0095  0.0976    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1240.7008, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 8.9310, p-val = 0.0033

Model Results:

             estimate      se    tval   df    pval   ci.lb   ci.ub     
intrcpt        0.0963  0.0415  2.3226  157  0.0215  0.0144  0.1782   * 
Effective_N    1.3131  0.4394  2.9885  157  0.0033  0.4452  2.1809  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
dat$Year <- as.numeric(str_extract(as.character(dat$Study),"[:digit:][:digit:][:digit:][:digit:]"))

decline_uni <- mod_func(formula = ~ Year)
summary(decline_uni)

Multivariate Meta-Analysis Model (k = 159; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 16.4273  -32.8546  -22.8546   -7.5734  -22.4573   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0170  0.1304     22     no  Species_Latin 
sigma^2.2  0.0138  0.1175     71     no          Study 
sigma^2.3  0.0080  0.0893    159     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 157) = 1313.2195, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 157) = 0.0057, p-val = 0.9397

Model Results:

         estimate      se     tval   df    pval    ci.lb   ci.ub    
intrcpt    0.3555  2.5932   0.1371  157  0.8911  -4.7666  5.4776    
Year      -0.0001  0.0013  -0.0758  157  0.9397  -0.0027  0.0025    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# The function for leave-one-study-out

dat$Study <- as.factor(dat$Study)

LeaveOneOut_effectsize <- list()
for(i in 1:length(levels(dat$Study))){
  dat1 <- dat[dat$Study != levels(dat$Study)[i], ]
  V_matrix <- impute_covariance_matrix(vi = dat1$vi, cluster = dat1$Shared_control, r = 0.5)
  
  LeaveOneOut_effectsize[[i]] <- rma.mv(yi, 
               V = V_matrix,
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="BFGS"),
               data = dat1)
  }


# writing function for extracting est, ci.lb, and ci.ub from all models
est.func <- function(mod){
  df <- data.frame(est = mod$b, lower = mod$ci.lb, upper = mod$ci.ub)
  return(df)
}

#using dplyr to form data frame
MA_LOO <- lapply(LeaveOneOut_effectsize, function(x) est.func(x))%>% bind_rows %>% mutate(left_out = levels(dat$Study))


saveRDS(MA_LOO,file = here("Rdata", "literature","MA_LOO.rds"))
Code
#telling ggplot to stop reordering factors
MA_LOO <- readRDS(file = here("Rdata",  "literature", "MA_LOO.rds"))

MA_LOO$left_out<- as.factor(MA_LOO$left_out)
MA_LOO$left_out<-factor(MA_LOO$left_out, levels = MA_LOO$left_out)


#plotting
leaveoneout_E <- ggplot(MA_LOO) +
  geom_hline(yintercept = 0, lty = 2, lwd = 1) +
  geom_hline(yintercept = mod$ci.lb, lty = 3, lwd = 0.75, colour = "black") +
  geom_hline(yintercept = mod$b, lty = 1, lwd = 0.75, colour = "black") +
  geom_hline(yintercept = mod$ci.ub, lty = 3, lwd = 0.75, colour = "black") +
  geom_pointrange(aes(x = left_out, y = est, ymin = lower, ymax = upper)) +
  xlab("Study left out") + 
  ylab("lnRR, 95% CI") + 
  coord_flip() +
  theme(panel.grid.minor = element_blank())+
  theme_bw() + theme(panel.grid.major = element_blank()) +
  theme(panel.grid.minor.x = element_blank() ) +
  theme(axis.text.y = element_text(size = 6))

leaveoneout_E

10 Meta-analysis: rodent data only

We note that the analyses below using rodent data are post-host analyses.

Code
# shared control 
# this does not seem to work
#V_matrix <- make_VCV_matrix(dat, V= "vi", cluster = "Shared_control", obs = "Effect_ID")
V_matrix <- impute_covariance_matrix(vi = rdat$vi, cluster = rdat$Shared_control, r = 0.5)

# meta-analysis basics
# phylo model
rmod <-  rma.mv(yi, V = V_matrix, mod = ~ 1, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = rdat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(rmod) 

Multivariate Meta-Analysis Model (k = 40; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 23.9404  -47.8807  -39.8807  -33.2265  -38.7043   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0018  0.0423      3     no  Species_Latin 
sigma^2.2  0.0089  0.0941     23     no          Study 
sigma^2.3  0.0027  0.0522     40     no      Effect_ID 

Test for Heterogeneity:
Q(df = 39) = 176.6345, p-val < .0001

Model Results:

estimate      se    tval  df    pval    ci.lb   ci.ub    
  0.0650  0.0380  1.7128  39  0.0947  -0.0118  0.1418  . 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
i2_ml(rmod) 
        I2_Total I2_Species_Latin         I2_Study     I2_Effect_ID 
        86.13553         11.50770         57.04649         17.58134 
Code
# visualizing the result
orchard_plot(rmod, xlab = "log response ratio (lnRR)", group = "Study")

Code
rmod_sex <-  rma.mv(yi, V = V_matrix, mod = ~ Sex, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = rdat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(rmod_sex) 

Multivariate Meta-Analysis Model (k = 40; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 22.6144  -45.2289  -35.2289  -27.0409  -33.3539   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0017  0.0414      3     no  Species_Latin 
sigma^2.2  0.0088  0.0936     23     no          Study 
sigma^2.3  0.0029  0.0543     40     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 38) = 164.4126, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 38) = 0.0501, p-val = 0.8241

Model Results:

         estimate      se    tval  df    pval    ci.lb   ci.ub    
intrcpt    0.0617  0.0403  1.5290  38  0.1345  -0.0200  0.1434    
SexMale    0.0074  0.0333  0.2238  38  0.8241  -0.0599  0.0748    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(rmod_sex) 
   R2_marginal R2_conditional 
   0.001033388    0.780759740 
Code
# visualizing the result
orchard_plot(rmod_sex, mod = "Sex", 
             xlab = "log response ratio (lnRR)", 
             group = "Study")

Code
# two more type of ages
rdat$lnAge_Trt <- log(rdat$Age_at_treatment_continuous)
rdat$Age_ratio <- (rdat$Age_at_treatment_continuous/rdat$Day_to_matuarity)
rdat$lnAge_ratio <- log(rdat$Age_at_treatment_continuous/rdat$Day_to_matuarity)


# just pure effect
rmod_mat <- rma.mv(yi, V = V_matrix, mod = ~ lnAge_ratio*Sex, 
               random = list(~1|Species_Latin, 
                             ~1|Study, 
                             ~1|Effect_ID), 
               data = rdat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
               )
summary(rmod_mat)

Multivariate Meta-Analysis Model (k = 40; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 21.8680  -43.7360  -29.7360  -18.6514  -25.7360   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0006  0.0237      3     no  Species_Latin 
sigma^2.2  0.0108  0.1037     23     no          Study 
sigma^2.3  0.0016  0.0396     40     no      Effect_ID 

Test for Residual Heterogeneity:
QE(df = 36) = 147.1755, p-val < .0001

Test of Moderators (coefficients 2:4):
F(df1 = 3, df2 = 36) = 1.7831, p-val = 0.1678

Model Results:

                     estimate      se     tval  df    pval    ci.lb   ci.ub    
intrcpt                0.0590  0.0347   1.7003  36  0.0977  -0.0114  0.1294  . 
lnAge_ratio           -0.0192  0.0152  -1.2562  36  0.2171  -0.0501  0.0118    
SexMale                0.0037  0.0327   0.1137  36  0.9101  -0.0626  0.0701    
lnAge_ratio:SexMale   -0.0102  0.0201  -0.5056  36  0.6162  -0.0510  0.0307    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(rmod_mat)
   R2_marginal R2_conditional 
    0.09196419     0.88970527 
Code
# visualizing the result
bubble_plot(rmod_mat, mod = "lnAge_ratio", group = "Study", 
            by = "Sex", 
            xlab = "ln(Treatment Day/Day to sexual maturity) [Rodent data only]", 
            ylab = "ln(Response ratio)")

11 Contrasting sexes: full data

Code
# full data
dat_long <- dat_long %>% mutate(abs_yi = folded_mu(yi, vi), 
                      abs_vi = folded_v(yi, vi))

# partial data
sdat_long <- sdat_long %>% mutate(abs_yi = folded_mu(yi, vi), 
                      abs_vi = folded_v(yi, vi))
Code
# variance covariance matrix
V_matrix_long <- impute_covariance_matrix(vi = dat_long$vi, cluster = dat_long$Shared_control, r = 0.5)

# we can run - some heteroscad models
# this does not improve model
mod_comp <-  rma.mv(yi, V = V_matrix_long, 
                 mod = ~ Comp_type - 1, 
                 random = list(~1|Species_Latin, 
                               ~1|Study, 
                               ~1|Effect_ID, 
                               ~1|Obs ), 
                 test = "t",
                 sparse = TRUE,
                 data = dat_long)
summary(mod_comp) 

Multivariate Meta-Analysis Model (k = 170; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  5.5127  -11.0253    0.9747   19.7184    1.4964   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0191  0.1381     15     no  Species_Latin 
sigma^2.2  0.0000  0.0000     34     no          Study 
sigma^2.3  0.0000  0.0000     85     no      Effect_ID 
sigma^2.4  0.0223  0.1492    170     no            Obs 

Test for Residual Heterogeneity:
QE(df = 168) = 1500.6613, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 168) = 0.1365, p-val = 0.8725

Model Results:

                        estimate      se    tval   df    pval    ci.lb   ci.ub 
Comp_typeboth_normal      0.0171  0.0454  0.3758  168  0.7076  -0.0726  0.1068 
Comp_typeone_castrated    0.0037  0.0450  0.0830  168  0.9340  -0.0851  0.0926 
                          
Comp_typeboth_normal      
Comp_typeone_castrated    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_comp)
   R2_marginal R2_conditional 
   0.001080811    0.462158653 
Code
# visualizing the result
orchard_plot(mod_comp, mod = "Comp_type", xlab = "log response ratio (lnRR)", 
             group = "Study", 
             cb = F)

Code
# naming factors
# dat_long$Comp_type <-  factor(dat_long$Comp_type, 
#                                  levels = c("one_castrated", "both_normal"),
#                                  labels = c("one_castrated", "both_normal") )

dat_long$Comp_type_Sex1 <- factor(dat_long$Comp_type_Sex, 
                                 levels = c("one_castrated_Male", "both_normal_Male",
                                            "one_castrated_Female", "both_normal_Female"),
                                 labels = c("Male sterlized/\nFemale normal",
                                            "Male normal/\nFemale normal",
                                            "Male normal/\nFemale sterlized",
                                            "Male normal/\nFemale normal (B)") )

mod_comp_sex <-  rma.mv(yi, V = V_matrix_long, mod = ~ Comp_type_Sex1 -1 , random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID, ~1|Obs ),data = dat_long, test = "t")
summary(mod_comp_sex) 

Multivariate Meta-Analysis Model (k = 170; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 24.2082  -48.4164  -32.4164   -7.5205  -31.4992   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0191  0.1382     15     no  Species_Latin 
sigma^2.2  0.0000  0.0000     34     no          Study 
sigma^2.3  0.0000  0.0000     85     no      Effect_ID 
sigma^2.4  0.0142  0.1190    170     no            Obs 

Test for Residual Heterogeneity:
QE(df = 166) = 1158.6282, p-val < .0001

Test of Moderators (coefficients 1:4):
F(df1 = 4, df2 = 166) = 11.6896, p-val < .0001

Model Results:

                                               estimate      se     tval   df 
Comp_type_Sex1Male sterlized/\nFemale normal     0.1297  0.0481   2.6949  166 
Comp_type_Sex1Male normal/\nFemale normal       -0.0115  0.0486  -0.2370  166 
Comp_type_Sex1Male normal/\nFemale sterlized    -0.1063  0.0476  -2.2332  166 
Comp_type_Sex1Male normal/\nFemale normal (B)    0.0518  0.0481   1.0774  166 
                                                 pval    ci.lb    ci.ub     
Comp_type_Sex1Male sterlized/\nFemale normal   0.0078   0.0347   0.2247  ** 
Comp_type_Sex1Male normal/\nFemale normal      0.8129  -0.1075   0.0844     
Comp_type_Sex1Male normal/\nFemale sterlized   0.0269  -0.2002  -0.0123   * 
Comp_type_Sex1Male normal/\nFemale normal (B)  0.2829  -0.0432   0.1468     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_comp_sex)
   R2_marginal R2_conditional 
     0.1848997      0.6530464 
Code
d0 <- orchard_plot(mod_comp_sex, mod = "Comp_type_Sex1", xlab = "log response ratio (lnRR)", 
                   group = "Study", 
                   cb = T, angle = 45) +
  geom_vline(xintercept=2.5, size = 0.2)

d0

Code
# plotting just male analyses - adjusting mod_comp_sex

res_sex <- mod_results(mod_comp_sex, mod = "Comp_type_Sex1", group = "Study")

attr(res_sex, "class") <- NULL

res_sex$mod_table <- res_sex$mod_table[1:2, ]
res_sex$data <- res_sex$data %>% filter(moderator == "Male sterlized/\nFemale normal"| moderator ==  "Male normal/\nFemale normal") 

res_sex2 <- res_sex

class(res_sex2) <-  c("orchard", "data.frame")

d01 <- orchard_plot(res_sex2, mod = "Comp_type_Sex1", xlab = "log response ratio (lnRR)", 
                   group = "Study", 
                   cb = T, flip = FALSE) 

d01

Code
# VCV matrix
abs_V_matrix_long <- impute_covariance_matrix(vi = dat_long$abs_vi, cluster = dat_long$Shared_control, r = 0.5)

abs_mod_comp_sex0 <-  rma.mv(abs_yi, V = abs_V_matrix_long, mod = ~ Comp_type_Sex1 , 
                             random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID, ~1|Obs ),
                             data = dat_long,  test = "t",
                 sparse = TRUE)
summary(abs_mod_comp_sex0) 

Multivariate Meta-Analysis Model (k = 170; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  95.4401  -190.8802  -174.8802  -149.9843  -173.9630   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0048  0.0690     15     no  Species_Latin 
sigma^2.2  0.0012  0.0350     34     no          Study 
sigma^2.3  0.0000  0.0000     85     no      Effect_ID 
sigma^2.4  0.0044  0.0662    170     no            Obs 

Test for Residual Heterogeneity:
QE(df = 166) = 929.3916, p-val < .0001

Test of Moderators (coefficients 2:4):
F(df1 = 3, df2 = 166) = 10.3634, p-val < .0001

Model Results:

                                               estimate      se     tval   df 
intrcpt                                          0.1501  0.0283   5.3088  166 
Comp_type_Sex1Male normal/\nFemale normal        0.0139  0.0219   0.6366  166 
Comp_type_Sex1Male normal/\nFemale sterlized     0.0995  0.0262   3.7999  166 
Comp_type_Sex1Male normal/\nFemale normal (B)   -0.0077  0.0262  -0.2939  166 
                                                 pval    ci.lb   ci.ub      
intrcpt                                        <.0001   0.0943  0.2059  *** 
Comp_type_Sex1Male normal/\nFemale normal      0.5252  -0.0292  0.0571      
Comp_type_Sex1Male normal/\nFemale sterlized   0.0002   0.0478  0.1511  *** 
Comp_type_Sex1Male normal/\nFemale normal (B)  0.7692  -0.0594  0.0440      

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
abs_mod_comp_sex <-  rma.mv(abs_yi, V = abs_V_matrix_long, mod = ~ Comp_type_Sex1 -1 , 
                            random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID, ~1|Obs), 
                            data = dat_long,  test = "t",
                 sparse = TRUE)
summary(abs_mod_comp_sex) 

Multivariate Meta-Analysis Model (k = 170; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  95.4401  -190.8802  -174.8802  -149.9843  -173.9630   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0048  0.0690     15     no  Species_Latin 
sigma^2.2  0.0012  0.0350     34     no          Study 
sigma^2.3  0.0000  0.0000     85     no      Effect_ID 
sigma^2.4  0.0044  0.0662    170     no            Obs 

Test for Residual Heterogeneity:
QE(df = 166) = 929.3916, p-val < .0001

Test of Moderators (coefficients 1:4):
F(df1 = 4, df2 = 166) = 21.0998, p-val < .0001

Model Results:

                                               estimate      se    tval   df 
Comp_type_Sex1Male sterlized/\nFemale normal     0.1501  0.0283  5.3088  166 
Comp_type_Sex1Male normal/\nFemale normal        0.1640  0.0287  5.7199  166 
Comp_type_Sex1Male normal/\nFemale sterlized     0.2496  0.0284  8.8009  166 
Comp_type_Sex1Male normal/\nFemale normal (B)    0.1424  0.0282  5.0412  166 
                                                 pval   ci.lb   ci.ub      
Comp_type_Sex1Male sterlized/\nFemale normal   <.0001  0.0943  0.2059  *** 
Comp_type_Sex1Male normal/\nFemale normal      <.0001  0.1074  0.2206  *** 
Comp_type_Sex1Male normal/\nFemale sterlized   <.0001  0.1936  0.3055  *** 
Comp_type_Sex1Male normal/\nFemale normal (B)  <.0001  0.0866  0.1982  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(abs_mod_comp_sex)
   R2_marginal R2_conditional 
     0.1548316      0.6429652 
Code
# visualizing results
d1 <- orchard_plot(abs_mod_comp_sex, mod = "Comp_type_Sex1", xlab = "absolute log response ratio (lnRR)", 
                   group = "Study", 
                   cb = T, angle = 45) +
  geom_vline(xintercept=2.5, size = 0.2)

d1

Code
# plotting just male analyses - adjusting mod_comp_sex

res_sex_abs <- mod_results(abs_mod_comp_sex, mod = "Comp_type_Sex1", group = "Study")

attr(res_sex_abs, "class") <- NULL

res_sex_abs$mod_table <- res_sex_abs$mod_table[1:2, ]
res_sex_abs$data <- res_sex_abs$data %>% filter(moderator == "Male sterlized/\nFemale normal"| moderator ==  "Male normal/\nFemale normal") 

res_sex_abs2 <- res_sex_abs

class(res_sex_abs2) <-  c("orchard", "data.frame")

d11 <- orchard_plot(res_sex_abs2, mod = "Comp_type_Sex1", xlab = "log response ratio (lnRR)", 
                   group = "Study", 
                   cb = T, flip = FALSE) 

d11

Code
d01 / d11

Code
# saving results for figs rds

saveRDS(res_sex2, file = here("Rdata", "fig", "res_sex_ma.rds"))
saveRDS(res_sex_abs2, file = here("Rdata", "fig", "res_sex_ma_abs.rds"))
Code
# female
female_dat_log <- dat_long %>% filter(Sex == "Female")
f_dat_log<- female_dat_log %>% group_by(Effect_ID) %>% summarise(yi2 = abs_yi[2] - abs_yi[1],
                                                     vi2 = abs_vi[1] + abs_vi[2] -
                                                       0.5*sqrt(abs_vi[1]*abs_vi[2]),
                                                     Species_Latin = Species_Latin[1],
                                                     Study = Study[1],
                                                     Shared_control = Shared_control[1])

# variance covariance matrix
V_matrix_long1 <- impute_covariance_matrix(vi = f_dat_log$vi2, cluster = f_dat_log$Shared_control, r = 0.5)

# we can run - some heteroscad models
# this does not improve model
f_mod_long <-  rma.mv(yi2, V = V_matrix_long1, 
                 random = list(~1|Species_Latin, 
                               ~1|Study, 
                               ~1|Effect_ID), 
                 data = f_dat_log, test = "t", sparse = TRUE)
summary(f_mod_long) 

Multivariate Meta-Analysis Model (k = 44; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 23.2097  -46.4193  -38.4193  -31.3745  -37.3667   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0045  0.0672     13     no  Species_Latin 
sigma^2.2  0.0000  0.0000     28     no          Study 
sigma^2.3  0.0035  0.0595     44     no      Effect_ID 

Test for Heterogeneity:
Q(df = 43) = 168.9263, p-val < .0001

Model Results:

estimate      se    tval  df    pval   ci.lb   ci.ub     
  0.0904  0.0320  2.8227  43  0.0072  0.0258  0.1549  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
i2_ml(f_mod_long)
        I2_Total I2_Species_Latin         I2_Study     I2_Effect_ID 
    7.053045e+01     3.952129e+01     4.435257e-07     3.100916e+01 
Code
# Pair figures
d2 <- ggplot(female_dat_log, aes(x = Comp_type, y = abs_yi)) + 
  geom_point(aes(size = sqrt(1/abs_vi), col = Comp_type), alpha = 0.5) +
  geom_line(aes(group = Effect_ID), alpha = 0.5) + 
  labs(y = "absolute log response ratio (lnRR)", x = "", size = "Precision (1/SE)") + 
  scale_x_discrete(labels = c("one_castrated" ="Male normal/\nFemale sterlized", "both_normal" = "Male normal/\nFemale normal")) +
  #xlim(c("one_castrated","both_normal"))+
  ylim(0, 1.25) + 
  scale_color_manual(values = c("#DDCC77", "#117733")) +
  coord_flip() +
  theme_bw() +
  guides(colour = "none") +
  theme(legend.position= c(1, 0), legend.justification = c(1, 0)) +
    theme(legend.title = element_text(size = 9)) +
    theme(legend.direction="horizontal") +
    theme(legend.background = element_blank()) +
    theme(axis.text.y = element_text(size = 10, colour ="black",
                                                            hjust = 0.5,
                                                            angle = 90))

d2

Code
d3 <- orchard_plot(f_mod_long, 
                   xlab = "absolute log response ratio (lnRR)", 
                   group = "Study", 
                   cb = F, angle = 90) + 
  scale_fill_manual(values =  "#999933") +
  scale_colour_manual(values =  "#999933") +
  scale_x_discrete(labels = "Male normal/Female sterlized vs. \nMale normal/Female normal") +
  ylim(-0.9, 0.5)
d3

Code
# pair figure male  
male_dat_log <- dat_long %>% filter(Sex == "Male")

m_dat_log<- male_dat_log %>% group_by(Effect_ID) %>% summarise(yi2 = abs_yi[2] - abs_yi[1],
                                                     vi2 = abs_vi[1] + abs_vi[2] -
                                                       0.5*sqrt(abs_vi[1]*abs_vi[2]),
                                                     Species_Latin = Species_Latin[1],
                                                     Study = Study[1],
                                                     Shared_control = Shared_control[1])

# variance covariance matrix
V_matrix_long2 <- impute_covariance_matrix(vi = m_dat_log$vi2, cluster = m_dat_log$Shared_control, r = 0.5)

# we can run - some hetero-scad models
# this does not improve model
m_mod_long <-  rma.mv(yi2, V = V_matrix_long2, 
                 random = list(~1|Species_Latin, 
                               ~1|Study, 
                               ~1|Effect_ID), 
                 data = m_dat_log, test = "t")
summary(m_mod_long) 

Multivariate Meta-Analysis Model (k = 41; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 12.6521  -25.3041  -17.3041  -10.5486  -16.1613   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0157  0.1252     12     no  Species_Latin 
sigma^2.2  0.0003  0.0185     28     no          Study 
sigma^2.3  0.0019  0.0441     41     no      Effect_ID 

Test for Heterogeneity:
Q(df = 40) = 96.4195, p-val < .0001

Model Results:

estimate      se     tval  df    pval    ci.lb   ci.ub    
 -0.0221  0.0462  -0.4784  40  0.6350  -0.1154  0.0712    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
i2_ml(m_mod_long)
        I2_Total I2_Species_Latin         I2_Study     I2_Effect_ID 
       90.745727        79.186792         1.729119         9.829816 
Code
d4 <- ggplot(male_dat_log, aes(x =Comp_type, y = abs_yi)) + 
  geom_point(aes(size = sqrt(1/abs_vi), col = Comp_type), alpha = 0.5) +
  geom_line(aes(group = Effect_ID), alpha = 0.5) + 
  labs(y = "absolute log response ratio (lnRR)", x = "", size = "Precision (1/SE)") + 
  scale_x_discrete(labels = c("one_castrated" ="Male sterlized/\nFemale normal", "both_normal" = "Male normal/\nFemale normal")) +
  ylim(0, 1.25) + 
  #coord_cartesian(xlim = c(0.5, 2.5)) +
  scale_color_manual(values = c("#88CCEE", "#CC6677")) +
  coord_flip() +
  theme_bw() +
  guides(colour = "none") +
  theme(legend.position= c(1, 0), legend.justification = c(1, 0)) +
    theme(legend.title = element_text(size = 9)) +
    theme(legend.direction="horizontal") +
    theme(legend.background = element_blank()) +
    theme(axis.text.y = element_text(size = 10, colour ="black",
                                                            hjust = 0.5,
                                                            angle = 90))

d4 

Code
d5 <- orchard_plot(m_mod_long, xlab = "absolute log response ratio (lnRR)", 
                   group = "Study", 
                   cb = F, angle = 90) + 
   scale_fill_manual(values = "#332288") +
  scale_colour_manual(values = "#332288") +
scale_x_discrete(labels = "Male sterlized/Female normal vs. \nMale normal/Female normal") +
  ylim(-0.9, 0.5)

d5

Code
patch <- d0 + d1 + plot_layout()

patch +  plot_annotation(tag_levels = "A")

Related figures

Code
patch2 <- (d2/d4)| (d3/d5) + plot_layout()

patch2 +  plot_annotation(tag_levels = "A")

12 Contrasting sexes: all-combination data

Code
# naming factor
sdat_long$Comp_type <-  factor(sdat_long$Comp_type, 
                                 levels = c("both_castrated", "both_normal"),
                                 labels = c("Male sterlized/\nFemale sterlized",
                                            "Male normal/\nFemale normal") )

# VCV matrix
V_matrix_long <- impute_covariance_matrix(vi = sdat_long$vi, cluster = sdat_long$Shared_control, r = 0.5)

# correlaiton matrix for phylogeny
# tree <- read.tree(here("data/tree_rotl.tre"))
# tree <- compute.brlen(tree)
# cor_tree <- vcv(tree, corr = TRUE)

# without heteroscedasticity
mod_comp2 <-  rma.mv(yi, V = V_matrix_long, mod = ~ Comp_type - 1, random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID, ~1|Obs),data = sdat_long, test = "t")
summary(mod_comp2) 

Multivariate Meta-Analysis Model (k = 64; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 24.7648  -49.5296  -37.5296  -24.7668  -36.0023   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0125  0.1118     10     no  Species_Latin 
sigma^2.2  0.0000  0.0000     25     no          Study 
sigma^2.3  0.0033  0.0571     32     no      Effect_ID 
sigma^2.4  0.0154  0.1242     64     no            Obs 

Test for Residual Heterogeneity:
QE(df = 62) = 2017.0006, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 62) = 0.1994, p-val = 0.8197

Model Results:

                                            estimate      se     tval  df 
Comp_typeMale sterlized/\nFemale sterlized   -0.0104  0.0482  -0.2156  62 
Comp_typeMale normal/\nFemale normal         -0.0264  0.0482  -0.5470  62 
                                              pval    ci.lb   ci.ub    
Comp_typeMale sterlized/\nFemale sterlized  0.8300  -0.1067  0.0860    
Comp_typeMale normal/\nFemale normal        0.5863  -0.1227  0.0700    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# without heteroscedasticity
mod_comp2b <-  rma.mv(yi, V = V_matrix_long, mod = ~ Comp_type, random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID, ~1|Obs),data = sdat_long, test = "t")
summary(mod_comp2b) 

Multivariate Meta-Analysis Model (k = 64; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 24.7648  -49.5296  -37.5296  -24.7668  -36.0023   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0125  0.1118     10     no  Species_Latin 
sigma^2.2  0.0000  0.0000     25     no          Study 
sigma^2.3  0.0033  0.0571     32     no      Effect_ID 
sigma^2.4  0.0154  0.1242     64     no            Obs 

Test for Residual Heterogeneity:
QE(df = 62) = 2017.0006, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 62) = 0.2342, p-val = 0.6301

Model Results:

                                      estimate      se     tval  df    pval 
intrcpt                                -0.0104  0.0482  -0.2156  62  0.8300 
Comp_typeMale normal/\nFemale normal   -0.0160  0.0330  -0.4839  62  0.6301 
                                        ci.lb   ci.ub    
intrcpt                               -0.1067  0.0860    
Comp_typeMale normal/\nFemale normal  -0.0820  0.0500    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
r2_ml(mod_comp2b)
   R2_marginal R2_conditional 
   0.002076156    0.506405183 
Code
# with heteroscedasticity
mod_comp2c <-  rma.mv(yi, V = V_matrix_long, 
                     mod = ~ Comp_type, 
                     random = list( ~1|Species_Latin, ~1|Study, ~Comp_type|Effect_ID),
                    rho = 0, struct = "HCS",
                     data = sdat_long, test = "t")
summary(mod_comp2c) 

Multivariate Meta-Analysis Model (k = 64; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 30.3689  -60.7377  -48.7377  -35.9749  -47.2105   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0057  0.0756     10     no  Species_Latin 
sigma^2.2  0.0000  0.0000     25     no          Study 

outer factor: Effect_ID (nlvls = 32)
inner factor: Comp_type (nlvls = 2)

            estim    sqrt  k.lvl  fixed                              level 
tau^2.1    0.0058  0.0763     32     no  Male sterlized/\nFemale sterlized 
tau^2.2    0.0343  0.1851     32     no        Male normal/\nFemale normal 
rho        0.0000                   yes                                    

Test for Residual Heterogeneity:
QE(df = 62) = 2017.0006, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 62) = 0.1620, p-val = 0.6887

Model Results:

                                      estimate      se     tval  df    pval 
intrcpt                                -0.0231  0.0330  -0.7005  62  0.4862 
Comp_typeMale normal/\nFemale normal   -0.0150  0.0374  -0.4025  62  0.6887 
                                        ci.lb   ci.ub    
intrcpt                               -0.0889  0.0428    
Comp_typeMale normal/\nFemale normal  -0.0897  0.0596    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# Comparing models with and without heteroscedasticity
AIC(mod_comp2, mod_comp2c)
           df       AIC
mod_comp2   6 -37.52956
mod_comp2c  6 -48.73773
Code
# visualizing results
f1 <- orchard_plot(mod_comp2c, mod = "Comp_type", 
                   xlab = "log response ratio (lnRR)", 
                   group = "Study", 
                   angle = 45) +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

f1

Code
# VCV matrix
abs_V_matrix_long <- impute_covariance_matrix(vi = sdat_long$abs_vi, cluster = sdat_long$Shared_control, r = 0.5)


# with heteroscedasticity
mod_comp3 <-  rma.mv(abs_yi, V = abs_V_matrix_long, 
                     mod = ~ Comp_type - 1, 
                     random = list( ~1|Species_Latin, ~1|Study, ~Comp_type|Effect_ID),
                    rho = 0, struct = "HCS",
                     data = sdat_long, test = "t")
summary(mod_comp3) 

Multivariate Meta-Analysis Model (k = 64; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 46.7119  -93.4239  -81.4239  -68.6611  -79.8966   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0008  0.0283     10     no  Species_Latin 
sigma^2.2  0.0000  0.0000     25     no          Study 

outer factor: Effect_ID (nlvls = 32)
inner factor: Comp_type (nlvls = 2)

            estim    sqrt  k.lvl  fixed                              level 
tau^2.1    0.0029  0.0540     32     no  Male sterlized/\nFemale sterlized 
tau^2.2    0.0256  0.1600     32     no        Male normal/\nFemale normal 
rho        0.0000                   yes                                    

Test for Residual Heterogeneity:
QE(df = 62) = 1423.9437, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 62) = 18.2633, p-val < .0001

Model Results:

                                            estimate      se    tval  df 
Comp_typeMale sterlized/\nFemale sterlized    0.0844  0.0170  4.9548  62 
Comp_typeMale normal/\nFemale normal          0.1547  0.0322  4.8113  62 
                                              pval   ci.lb   ci.ub      
Comp_typeMale sterlized/\nFemale sterlized  <.0001  0.0503  0.1184  *** 
Comp_typeMale normal/\nFemale normal        <.0001  0.0904  0.2190  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# with heteroscedasticity
mod_comp3b <-  rma.mv(abs_yi, V = abs_V_matrix_long, 
                      mod = ~ Comp_type, 
                      random = list( ~1|Species_Latin, ~1|Study, ~Comp_type|Effect_ID),
                      rho = 0, struct = "HCS",
                      data = sdat_long, test = "t")
summary(mod_comp3b)

Multivariate Meta-Analysis Model (k = 64; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 46.7119  -93.4239  -81.4239  -68.6611  -79.8966   

Variance Components:

            estim    sqrt  nlvls  fixed         factor 
sigma^2.1  0.0008  0.0283     10     no  Species_Latin 
sigma^2.2  0.0000  0.0000     25     no          Study 

outer factor: Effect_ID (nlvls = 32)
inner factor: Comp_type (nlvls = 2)

            estim    sqrt  k.lvl  fixed                              level 
tau^2.1    0.0029  0.0540     32     no  Male sterlized/\nFemale sterlized 
tau^2.2    0.0256  0.1600     32     no        Male normal/\nFemale normal 
rho        0.0000                   yes                                    

Test for Residual Heterogeneity:
QE(df = 62) = 1423.9437, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 62) = 5.0020, p-val = 0.0289

Model Results:

                                      estimate      se    tval  df    pval 
intrcpt                                 0.0844  0.0170  4.9548  62  <.0001 
Comp_typeMale normal/\nFemale normal    0.0703  0.0314  2.2365  62  0.0289 
                                       ci.lb   ci.ub      
intrcpt                               0.0503  0.1184  *** 
Comp_typeMale normal/\nFemale normal  0.0075  0.1332    * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# this function does not work with heterogenious variance
#r2_ml(mod_comp3b) 

# without heteroscedasticity
mod_comp3c <-  rma.mv(abs_yi, V = abs_V_matrix_long, 
                      mod = ~ Comp_type, 
                      random = list( ~1|Species_Latin, ~1|Study, ~1|Effect_ID),
                      #rho = 0, struct = "HCS",
                      data = sdat_long, test = "t")

# Comparing models with and without heteroscedasticity
AIC(mod_comp3, mod_comp3c)
           df       AIC
mod_comp3   6 -81.42389
mod_comp3c  5 491.98996
Code
# visualizing results
f2 <- orchard_plot(mod_comp3b, mod = "Comp_type", 
                   xlab = "absolute log response ratio (lnRR)", 
             group = "Study", 
             angle = 45) +
  scale_fill_manual(values = c("#D55E00", "#009E73")) +
  scale_colour_manual(values = c("#D55E00", "#009E73")) 

f2

Code
patch3 <- f1 / f2 + plot_layout()

patch3 +  plot_annotation(tag_levels = "A")

13 PART II: HEALTHSPAN ANALYSIS ON LITERATURE DATA

14 Data preparation & processing

Code
# remove odl data
dat_full <- read.csv(here("data", "healthspan", "healthspan3.csv"), na = c("", "NA"))

dat_full %>% 
  mutate_if(is.character, as.factor) -> dat

# Effect_ID is the unique identifier for the effect
dat$Effect_ID <- factor(1:nrow(dat))

effect_type <- ifelse(str_detect(dat$measurement_parameter, "rop"), "proportion", "other")


kable(dat, "html") %>% 
  kable_styling("striped", position = "left") %>% 
  scroll_box(width = "100%", 
    height = "250px")
Study order.checked cohort shared.control Age.at.test Age.at.test_months Measure Sub.measure Checked direction.of.improved.health Measurement.type Measure_exact.notes Gonads_removed Control_treatment Sex Species_Latin Species Strain Mixedsexenvironment Environment Wild_or_semi_wild Age_at_treatment Age.at.treatment_weeks Control_value Experimental_value Error_control_extracted Error_experimental_extracted measurement_parameter measurement_unit Error_unit Error_control_SD Error_experimental_SD whole.IQR.control whole.IQR.treatment control.sample.size.range experomental.sample.size.range Coefficent_unit Sample_size_control Sample_size_experimental Notes Notes2 Notes3 Effect_ID
hewitson 2012 59 3 3 12 months 12 cardiac function Cardiac function/pathology checked decreased cardiac fibrosis cardiac fibrosis yes Sham Male Mus musculus Mice RlnWT no Laboratory No 4 weeks 4.00 0.9982000 0.9928000 0.062 0.04 mean % SEM 0.1518684 0.0979796 NA NA NA NA NA 6 6 fig2A NA NA 1
Morin-Grandmont 2024 87 51 51 12 months 12 cardiac function Cardiac function/pathology extracted decreased cardiac fibrosis cardiac fibrosis yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 7 weeks 7.00 1.2855697 1.6530421 0.158024969 0.218865128 Mean percentage SEM 0.4327692 0.5993868 NA NA 7 to 8 7 to 8 NA 8 8 Fig 4C NA NA 2
Morin-Grandmont 2024 88 52 52 24 months 24 cardiac function Cardiac function/pathology extracted decreased cardiac fibrosis cardiac fibrosis yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 12 months 52.00 0.9014734 1.0728533 0.03182994 0.145292438 Mean percentage SEM 0.0871699 0.3978997 NA NA 7 to 8 7 to 8 NA 8 8 Fig 4C NA NA 3
Moore 2022 170 69 69 14 months 14 cardiac function Cardiac function/pathology extracted decreased cardiac fibrosis cardiac fibrosis yes Sham Female Mus musculus Mice C57BL6 no NA NA 10 weeks 10.00 0.6498000 0.4276000 0.1524 0.0656 mean secs SEM 0.3407768 0.1466861 NA NA NA NA NA 5 5 Appendix A NA NA 4
Ayaz 2019 15 1 1 16-18 months 17 cardiac function Cardiac function/pathology Yes Increased E/A ratio E/A ratio yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 1.5700000 1.6300000 0.06 0.05 mean ratio SE 0.2244994 0.2061553 NA NA NA NA NA 14 17 Fig8 NA NA 5
banga 2021 24 19 19 18 months 18 cardiac function Cardiac function/pathology Yes Increased E/A ratio E/A ratio yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 1.5900000 1.2600000 0.19 0.07 mean ratio SEM 0.6008328 0.2321637 NA NA NA NA NA 10 11 table 1 NA NA 6
Walsh-Wilkinson 2022 172 70 70 12 months 12 cardiac function Cardiac function/pathology extracted Increased E/A ratio E/A ratio yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 1.6000000 1.5800000 0.03 0.04 mean ratio SEM 0.1200000 0.1131371 NA NA NA NA NA 16 8 Table S2 and 6 NA NA 7
Walsh-Wilkinson 2022 171 71 71 12 months 12 cardiac function Cardiac function/pathology extracted Increased E/A ratio E/A ratio yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 1.6000000 1.5400000 0.03 0.05 mean ratio SEM 0.1161895 0.1414214 NA NA NA NA NA 15 8 Table S2 and 6 NA NA 8
Ayaz 2019 16 1 1 16-18 months 17 cardiac function Cardiac function/pathology Yes Increased Ejection fraction Ejection fraction yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 58.7900000 62.4800000 2.81 1.67 mean % SE 10.5140573 6.8855864 NA NA NA NA NA 14 17 Fig8 NA NA 9
Fares 2013 39 2 2 24 months 24 cardiac function Cardiac function/pathology checked Increased Ejection fraction Ejection fraction yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 60.4500000 60.4500000 2.69 2.32 mean % SE 6.5891274 5.6828162 NA NA NA NA NA 6 6 fig 2 NA NA 10
banga 2021 17 19 19 18 months 18 cardiac function Cardiac function/pathology Yes Increased Ejection fraction Ejection fraction yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 64.7500000 72.7100000 3.81 2.28 mean % SEM 12.0482779 7.5619045 NA NA NA NA NA 10 11 table 1 NA NA 11
Morin-Grandmont 2024 86 52 52 24 months 24 cardiac function Cardiac function/pathology checked Increased Ejection fraction Ejection fraction yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 12 months 52.00 58.5900000 56.3800000 2.34 1.86 mean percentage SEM 6.4083539 5.0938198 NA NA 7 to 8 7 to 8 NA 8 8 Fig4B NA NA 12
Walsh-Wilkinson 2022 174 70 70 12 months 12 cardiac function Cardiac function/pathology extracted Increased Ejection fraction Ejection fraction yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 55.0000000 59.0000000 1.7 1.6 mean percentage SEM 6.8000000 4.5254834 NA NA NA NA NA 16 8 Table S2 and 6 NA NA 13
Walsh-Wilkinson 2022 173 71 71 12 months 12 cardiac function Cardiac function/pathology extracted Increased Ejection fraction Ejection fraction yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 60.0000000 61.0000000 1.6 2.1 mean percentage SEM 6.1967734 5.9396970 NA NA NA NA NA 15 8 Table S2 and 6 NA NA 14
Ayaz 2019 11 1 1 16-18 months 17 cardiac function Cardiac function/pathology Yes Increased fractional shortening fractional shortening yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 26.7500000 29.2700000 2.36 1.39 mean % SE 11.0693812 7.4853791 NA NA NA NA NA 22 29 Fig8 NA NA 15
Fares 2013 37 2 2 24 months 24 cardiac function Cardiac function/pathology checked Increased fractional shortening LV fractional shortening yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 27.8300000 28.0500000 1.8 1.24 mean % SE 4.4090815 3.0373673 NA NA NA NA NA 6 6 fig 2 NA NA 16
Walsh-Wilkinson 2022 176 70 70 12 months 12 cardiac function Cardiac function/pathology extracted Increased fractional shortening fractional shortening yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 33.2000000 32.2000000 1.2 1.6 mean percentage SEM 4.8000000 4.5254834 NA NA NA NA NA 16 8 Table S2 and 6 NA NA 17
Walsh-Wilkinson 2022 175 71 71 12 months 12 cardiac function Cardiac function/pathology extracted Increased fractional shortening fractional shortening yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 34.3000000 29.1000000 0.89 1.51 mean percentage SEM 3.4469552 4.2709250 NA NA NA NA NA 15 8 Table S2 and 6 NA NA 18
Ayaz 2019 14 1 1 16-18 months 17 cardiac function Cardiac function/pathology Yes decreased Left Ventricular Isovolumic Relaxation Time Left Ventricular Isovolumic Relaxation Time. yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 12.7400000 17.0000000 1.04 0.97 mean ms SE 4.8780324 5.2236099 NA NA NA NA NA 22 29 Fig8 NA NA 19
banga 2021 23 19 19 18 months 18 cardiac function Cardiac function/pathology Yes decreased Left Ventricular Isovolumic Relaxation Time Left Ventricular Isovolumic Relaxation Time. yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 10.4600000 12.5100000 0.83 0.45 mean ms SEM 2.6246905 1.4924812 NA NA NA NA NA 10 11 table 1 NA NA 20
Moore 2022 169 69 69 14 months 14 cardiac function Cardiac function/pathology extracted decreased Left Ventricular Isovolumic Relaxation Time Left Ventricular Isovolumic Relaxation Time. yes Sham Female Mus musculus Mice C57BL6 no NA NA 10 weeks 10.00 0.0207000 0.0165000 0.0009 0.0008 mean secs SEM 0.0020125 0.0017889 NA NA NA NA NA 5 5 Appendix A NA NA 21
Walsh-Wilkinson 2022 182 70 70 12 months 12 cardiac function Cardiac function/pathology extracted decreased Left Ventricular Isovolumic Relaxation Time Left Ventricular Isovolumic Relaxation Time. yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 15.3000000 18.0000000 0.47 0.7 mean milliseconds SEM 1.8800000 1.9798990 NA NA NA NA NA 16 8 Table S2 and 6 NA NA 22
Walsh-Wilkinson 2022 181 71 71 12 months 12 cardiac function Cardiac function/pathology extracted decreased Left Ventricular Isovolumic Relaxation Time Left Ventricular Isovolumic Relaxation Time. yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 15.8000000 15.8000000 0.39 0.81 mean milliseconds SEM 1.5104635 2.2910260 NA NA NA NA NA 15 8 Table S2 and 6 NA NA 23
Ayaz 2019 10 1 1 16-18 months 17 cardiac function Cardiac size Yes decreased Cardiomyocyte size Myoctye area yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 4 weeks 4.00 3738.0000000 3266.0000000 186 207 mean um squared SE 1302.0000000 1325.4467170 NA NA NA NA NA 49 41 table 1 These sample sizes look too big. Are these multiple readings from the same animals? NA 24
Fares 2013 41 2 2 24 months 24 cardiac function Cardiac size extracted decreased Cardiomyocyte size Myoctye fibre size yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 35.4000000 29.8000000 1.6 1.3 mean pL SEM 6.1967734 5.2000000 NA NA NA NA NA 15 16 table 1 NA NA 25
banga 2021 25 19 19 20 -26 months 23 cardiac function Cardiac size Yes decreased Cardiomyocyte size myocyte fiber width yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 28.3700000 34.3400000 1.29 1.21 mean um SEM 8.6535831 7.9345006 NA NA NA NA NA 45 43 fig 6 These sample sizes look too big. Are these multiple readings from the same animals? NA 26
Morin-Grandmont 2024 90 51 51 24 months 24 cardiac function Cardiac size extracted decreased Cardiomyocyte size Cardiomyocyte CSA yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 12 months 52.00 493.6313582 457.5598274 32.56423702 64.84111416 Mean um2 SEM 89.1808359 177.5747044 NA NA 7 to 8 7 to 8 NA 8 8 Fig2D NA NA 27
Morin-Grandmont 2024 89 51 51 12 months 12 cardiac function Cardiac size extracted decreased Cardiomyocyte size Cardiomyocyte CSA yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 7 weeks 7.00 352.1735711 352.9776383 38.02307289 63.28756375 Mean um2 SEM 104.1304736 173.3201314 NA NA 7 to 8 7 to 8 NA 8 8 Fig3A NA NA 28
Ayaz 2019 9 1 1 16-18 months 17 cardiac function Cardiac size Yes decreased Heart size heart weight/tibia weight yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 11.2000000 9.6000000 0.9 1 mean mg/mm SE 2.0124612 2.2360680 NA NA NA NA NA 5 5 table 1 Sample size changed from 9 to 5 NA 29
banga 2021 26 19 19 22-24 months 23 cardiac function Cardiac size Yes decreased Heart size heart size rel to body weight yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 4.0600000 4.3900000 0.38 0.34 mean mg/g SEM 1.1078809 0.9912618 NA NA 6 to 11 6 to 11 NA 9 9 fig 6 NA NA 30
Pijacka 2015 100 24 24 12 months 12 cardiac function Cardiac size checked decreased Heart size heart siz/body weight yes Sham Female Ratus ratus Rat wistar no Laboratory No 10 weeks 10.00 0.3200000 0.2600000 0.02 0.02 mean % SEM 0.0565685 0.0565685 NA NA NA NA NA 8 8 Table 1 NA NA 31
Pijacka 2015 101 25 25 18 months 18 cardiac function Cardiac size checked decreased Heart size heart siz/body weight yes Sham Female Ratus ratus Rat wistar no Laboratory No 10 weeks 10.00 0.3000000 0.2500000 0.01 0.01 mean % SEM 0.0282843 0.0282843 NA NA NA NA NA 8 8 Table 1 NA NA 32
Morin-Grandmont 2024 82 51 51 12 months 12 cardiac function Cardiac size checked decreased Heart size heart weight/tibia weight yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 7 weeks 7.00 5.4452926 5.5216285 0.229007634 0.190839695 Mean mg/mm SEM 0.6271632 0.5397762 NA NA NA NA NA 8 8 Fig2D NA NA 33
Morin-Grandmont 2024 84 52 52 24 months 24 cardiac function Cardiac size checked decreased Heart size heart weight/tibia weight yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 12 months 52.00 6.6157761 5.7633588 0.114503817 0.127226463 Mean mg/mm SEM 0.3238657 0.3598508 NA NA NA NA NA 8 8 Fig2D NA NA 34
banga 2023 163 66 66 25 months 25 cardiac function Cardiac size extracted decreased Heart size heart weight/tibia weight yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 9.0400000 8.0000000 0.6 0.34 mean mg/mm SE 1.5874508 0.8995554 NA NA NA NA NA 7 7 table 2 NA NA 35
Walsh-Wilkinson 2022 178 70 70 12 months 12 cardiac function Cardiac size extracted decreased Heart size heart weight/tibia weight yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 4.6000000 4.5000000 0.03 0.26 mean mg/g SEM 0.1200000 0.7353911 NA NA NA NA NA 16 8 Table 2 and S6 NA NA 36
Walsh-Wilkinson 2022 177 71 71 12 months 12 cardiac function Cardiac size extracted decreased Heart size heart weight/tibia weight yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 4.3000000 3.3000000 0.15 0.28 mean mg/g SEM 0.5809475 0.7919596 NA NA NA NA NA 15 8 Table 2 and S6 NA NA 37
Ayaz 2019 13 1 1 16-18 months 17 cardiac function Cardiac size Yes decreased left ventricle size IVPWd yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 0.0659339 0.0647975 0.004685621 0.005139274 mean cm SE 0.0219775 0.0276758 NA NA NA NA NA 22 29 Fig8 NA NA 38
Ayaz 2019 12 1 1 16-18 months 17 cardiac function Cardiac size Yes decreased left ventricle size LV mass yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 4weeks 4.00 0.0915000 0.0750000 0.005625 0.0045 mean g SE 0.0263836 0.0242332 NA NA NA NA NA 22 29 Fig8 NA NA 39
Fares 2013 38 2 2 24 months 24 cardiac function Cardiac size extracted decreased left ventricle size LVPWd yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 0.8022275 0.7335076 0.080777357 0.01362378 mean mm SE 0.1978633 0.0333713 NA NA NA NA NA 6 6 fig 2 just extracted LVPWd but other heart measurement values are also included NA 40
Fares 2013 40 2 2 24 months 24 cardiac function Cardiac size checked decreased left ventricle size ventricle weight/body weight yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 4 weeks 4.00 6.3000000 5.2000000 0.4 0.3 mean mg/g SEM 0.8944272 0.6000000 NA NA NA NA NA 5 4 table 1 NA NA 41
hewitson 2012 58 3 3 12 months 12 cardiac function Cardiac size checked decreased left ventricle size LV/BW yes Sham Male Mus musculus Mice RlnWT no Laboratory No 4 weeks 4.00 3.6000000 3.5000000 0.1 0.3 mean mg/g SEM 0.2449490 0.7348469 NA NA NA NA NA 6 6 table 1 NA NA 42
banga 2021 18 19 19 18 months 18 cardiac function Cardiac size Yes decreased left ventricle size left ventricle mass yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 144.0200000 118.2000000 8.69 11.87 mean mg SEM 27.4801929 39.3683363 NA NA NA NA NA 10 11 table 1 NA NA 43
banga 2021 19 19 19 18 months 18 cardiac function Cardiac size Yes decreased left ventricle size LVAWd yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 1.1700000 1.0300000 0.06 0.08 mean mm SEM 0.1897367 0.2653300 NA NA NA NA NA 10 11 table 1 Should we just be using the diastole values here? That is the more important one (i.e. LVPWd) NA 44
banga 2021 20 19 19 18 months 18 cardiac function Cardiac size Yes decreased left ventricle size LVAWs yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 1.6400000 1.4900000 0.07 0.1 mean mm SEM 0.2213594 0.3316625 NA NA NA NA NA 10 11 table 1 Should we just be using the diastole values here? That is the more important one (i.e. LVPWd) NA 45
banga 2021 21 19 19 18 months 18 cardiac function Cardiac size Yes decreased left ventricle size LVPWd yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 0.9200000 0.8400000 0.06 0.05 mean mm SEM 0.1897367 0.1658312 NA NA NA NA NA 10 11 table 1 Should we just be using the diastole values here? That is the more important one (i.e. LVPWd) NA 46
banga 2021 22 19 19 18 months 18 cardiac function Cardiac size Yes decreased left ventricle size LVPWs yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 1 month 4.00 1.3500000 1.4300000 0.08 0.07 mean mm SEM 0.2529822 0.2321637 NA NA NA NA NA 10 11 table 1 Should we just be using the diastole values here? That is the more important one (i.e. LVPWd) NA 47
Morin-Grandmont 2024 83 51 51 12 months 12 cardiac function Cardiac size checked decreased left ventricle size posterior LV wall thickness + interventricular septal wall thickness yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 7 weeks 7.00 1.6000000 1.6800000 0.6 0.05 Mean mm SEM 1.6970563 0.1414214 NA NA NA NA NA 8 8 Fig3A NA NA 48
Morin-Grandmont 2024 85 52 52 24 months 24 cardiac function Cardiac size checked decreased left ventricle size posterior LV wall thickness + interventricular septal wall thickness yes intact Female Mus musculus Mice C57Bl6/J no Laboratory No 12 months 52.00 1.8300000 1.6100000 0.07 0.04 Mean mm SEM 0.1979899 0.1131371 NA NA NA NA NA 8 8 Fig3A NA NA 49
Walsh-Wilkinson 2022 180 70 70 12 months 12 cardiac function Cardiac size extracted decreased left ventricle size PW: diastolic posterior wall thickness  yes Sham Male Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 0.9300000 0.8100000 0.02 0.012 mean mm SEM 0.0800000 0.0339411 NA NA NA NA NA 16 8 Table S2 and 6 NA NA 50
Walsh-Wilkinson 2022 179 71 71 12 months 12 cardiac function Cardiac size extracted decreased left ventricle size PW: diastolic posterior wall thickness  yes Sham Female Mus musculus Mice C57BL6 no NA NA 6 weeks 6.00 0.8400000 0.9000000 0.01 0.018 mean mm SEM 0.0387298 0.0509117 NA NA NA NA NA 15 8 Table S2 and 6 NA NA 51
picazo 2016 96 21 21 13 months 13 Cognition Cognition extracted Increased Autoshaping learning test number of conditioned responses yes intact Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 0.4370445 0.1030803 0.109442319 0.109683914 mean number SEM 0.2447205 0.2452607 NA NA NA NA NA 5 5 fig1A NA NA 52
picazo 2016 97 21 21 18 months 18 Cognition Cognition extracted Increased Autoshaping learning test number of conditioned responses yes intact Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 0.0968794 0.0927723 0.114032615 0.120958325 mean number SEM 0.2549847 0.2704710 NA NA NA NA NA 5 5 fig1A NA NA 53
Jiang et al Biorvx 2023 141 60 60 12.5 months 12.5 Cognition Cognition extracted decreased Barnes maze test Barnes Maze test_time spent with incorrect hole Yes Sham Male Mus musculus Mice C57BL6 no Laboratory No 8 weeks 8.00 57.7310000 17.7235000 13.52813 5.63127 mean sec SEM 48.7763664 13.7937381 NA NA NA NA NA 13 6 fig1F 12-13 months oldStated that hair greying delayed and also there is rectal temperator data NA 54
Jiang et al Biorvx 2023 140 60 60 12.5 months 12.5 Cognition Cognition extracted decreased Barnes maze test Barnes Maze test_time to find correct hole Yes Sham Male Mus musculus Mice C57BL6 no Laboratory No 8 weeks 8.00 162.5326000 69.9328000 25.45105 13.07186 mean sec SEM 80.4832868 32.0193870 NA NA NA NA NA 10 6 fig 1E 12-13 months oldStated that hair greying delayed and also there is rectal temperator data NA 55
Leffa 2013 76 12 12 18 months 18 Cognition Cognition extracted Increased inhibitory avoidance test inhibitory avoidance test yes Sham Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 4.1700000 9.3500000 0.59(lower)6.31 (upper) 3.72(lower)25.05(upper) median latency to step interquartile interval 4.3630816 16.2700229 5.720 21.33 NA NA NA 12 12 Fig2 NA NA 56
Hou 2013 63 5 5 12 months 12 Cognition Cognition checked decreased Morris water maze morris water maze latency to find platform in probe test yes Sham Female Mus musculus Mice ICR no Laboratory No 8 weeks 8.00 22.1600000 36.5000000 6.89 4.5 mean s SD 6.8900000 4.5000000 NA NA NA NA NA 10 10 Fig 1 NA NA 57
Hou 2013 64 5 5 12 months 12 Cognition Cognition checked Increased Morris water maze morris water mazeplatform crossings yes Sham Female Mus musculus Mice ICR no Laboratory No 8 weeks 8.00 2.8900000 1.8500000 1.215 1.39 mean n SD 1.2150000 1.3900000 NA NA NA NA NA 10 10 fig 1 NA NA 58
Hou 2013 65 6 6 12 months 12 Cognition Cognition checked decreased Morris water maze morris water maze latency to find platform in probe test yes Sham Male Mus musculus Mice ICR no Laboratory No 8 weeks 8.00 27.6600000 34.3200000 10.16 5.95 mean s SD 10.1600000 5.9500000 NA NA NA NA NA 10 10 Fig 1 NA NA 59
Hou 2013 66 6 6 12 months 12 Cognition Cognition checked Increased Morris water maze morris water mazeplatform crossings yes Sham Male Mus musculus Mice ICR no Laboratory No 8 weeks 8.00 2.4240000 2.6500000 1.54 1.59 mean n SD 1.5400000 1.5900000 NA NA NA NA NA 10 10 Fig 1 NA NA 60
Koebele 2023 71 20 20 early middle age 12 months 12 Cognition Cognition checked Increased Morris water maze moris maze: probe trial NE (correct) quadrant yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 0.4700000 0.4900000 0.059 0.046 mean proportion SE 0.1865744 0.1380000 NA NA NA NA NA 10 9 fig 4D NA NA 61
Koebele 2023 72 20 20 late middle age at 17 months 17 Cognition Cognition checked Increased Morris water maze moris maze: probe trial NE (correct) quadrant yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 0.3900000 0.3700000 0.04 0.051 mean proportion SE 0.1200000 0.1349333 NA NA NA NA NA 9 7 fig4F NA NA 62
galea 2018 42 22 22 14 months 14 Cognition Cognition checked Increased Morris water maze Morris water maze (percentage of time in quadrant in probe trial) yes Sham Female Ratus ratus Rat sprague-Dawley no Laboratory No 8 months 35.00 29.4000000 31.7000000 2.5 2.2 mean % SEM 7.9056942 6.9570109 NA NA NA NA NA 10 10 table 3 nulliparous Data is also presented for a second test, reversal learning. Have not included this but could come under other memory tests? Stated that it is a test of cognitive flexibility 63
galea 2018 43 23 23 14 months 14 Cognition Cognition checked Increased Morris water maze Morris water maze (percentage of time in quadrant in probe trial) yes Sham Female Ratus ratus Rat sprague-Dawley no Laboratory No 8 months 35.00 28.5000000 34.3000000 4.6 2.9 mean % SEM 13.0107648 9.6182119 NA NA NA NA NA 8 11 table 3 primiparous Data is also presented for a second test, reversal learning. Have not included this but could come under other memory tests? Stated that it is a test of cognitive flexibility 64
Itoh et al 2023 137 57 57 12-14 months 13 Cognition Cognition extracted Increased Morris water maze Morris water maze probe trial time in correct quadrant Yes unclear Male Mus musculus Mice C57BL6 no Laboratory No 2 months old 8.00 37.5000000 39.5000000 36.101 (lower) 41.134 (upper) 36.38(lower) 41.28 (upper) median percentage in correct zone IQR 3.8244681 3.7234043 5.033 4.90 NA NA NA 14 7 Fg 2 NA NA 65
Itoh et al 2023 138 58 58 12-14 months 13 Cognition Cognition extracted Increased Morris water maze Morris water maze probe trial time in correct quadrant Yes unclear Female Mus musculus Mice C57BL6 no NA NA 2 months old 8.00 34.9191770 25.8702356 33.81(lower) 44.08 (upper) 20.34 (lower)31.18(upper) median percentage in correct zone IQR 7.7218045 8.1503759 10.270 10.84 NA NA NA 30 8 Fig 2 NA NA 66
Borbelyova et al 2016 134 77 77 30 months 30 Cognition Cognition extracted Increased novel object recognition Novel object recognition test Yes unclear Male Ratus ratus Rat wistar albino no Laboratory No Day 47 6.50 4.1732271 12.1028876 1.483910276 3.075325883 mean difference exploring novel object SEM 5.7471598 11.5068158 NA NA NA NA NA 15 14 Fig3C NA NA 67
Leffa 2013 75 12 12 18 months 18 Cognition Cognition checked Increased novel object recognition novel object recognition yes Sham Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 0.6780000 0.6660000 0.068 0.036 mean recognition index SE 0.2355589 0.1247077 NA NA NA NA NA 12 12 Fig1 NA NA 68
Wang 2021 121 53 53 14-15months 14.5 Cognition Cognition checked Increased novel object recognition novel object recognition yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 8months 35.00 0.2800000 0.3900000 0.02 0.029 mean index SEM 0.0565685 0.0820244 NA NA NA NA NA 8 8 fig5i NA NA 69
Wang 2021 126 54 54 18 month 18 Cognition Cognition checked Increased novel object recognition novel recognition open field Yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 8 months 35.00 0.1700000 0.1900000 0.03 0.03 mean index S.E.M 0.0848528 0.0848528 NA NA NA NA NA 8 8 Fig S3E NA NA 70
Heikkinen 2004 52 10 10 24 months 24 Cognition Cognition checked decreased RAM memory test RAM memory test: reference memory errors yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 5 months 22.00 111.9100000 115.7700000 6.53 3.85 mean n SEM 17.2767561 12.7690054 NA NA NA NA NA 7 11 fig 1 & n in text NA NA 71
Heikkinen 2004 55 10 10 24 months 24 Cognition Cognition checked decreased RAM memory test RAM memory test: reference memory errors yes Sham Female Mus musculus Mice C57Bl6/J no NA NA 5 months 22.00 111.3700000 115.0300000 7.32 5.23 mean n SEM 19.3668996 17.3459476 NA NA NA NA NA 7 11 fig2 NA NA 72
Heikkinen 2004 53 10 10 24 months 24 Cognition Cognition checked decreased RAM memory test RAM memory test: rworking memory errors yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 5 months 22.00 45.4300000 32.9800000 12.98 5.82 mean n SEM 34.3418520 19.3027563 NA NA NA NA NA 7 11 fig 1 NA NA 73
Heikkinen 2004 56 10 10 24 months 24 Cognition Cognition checked decreased RAM memory test RAM memory test: rworking memory errors yes Sham Female Mus musculus Mice C57Bl6/J no NA NA 5 months 22.00 46.3400000 33.9100000 12.34 5.7 mean n SEM 32.6485712 18.9047613 NA NA NA NA NA 7 11 fig2 NA NA 74
Heikkinen 2004 54 10 10 24 months 24 Cognition Cognition checked Increased T maze test T maze total correct choices yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 5 months 22.00 35.9300000 29.3750000 0.94 1.87 mean n SEM 2.4870062 6.2020884 NA NA NA NA NA 7 11 fig 1 NA NA 75
Koebele 2023 69 20 20 early middle age 12 months 12 Cognition Cognition checked decreased water radial arm maze test water radial arm maze: delayed memory retention number of errors yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 1.9100000 1.5400000 0.525 0.395 mean number SE 1.5750000 1.1850000 NA NA NA NA NA 9 9 fig2H Data is also presented for a NA 76
Koebele 2023 67 20 20 early middle age 12 months 12 Cognition Cognition checked decreased water radial arm maze test water radial arm maze: WMI errors maximum working memory load yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 1.6060000 1.3240000 0.28 0.2 mean number SE 0.8854377 0.6000000 NA NA NA NA NA 10 9 fig2H Data is also presented for a NA 77
Koebele 2023 68 20 20 late middle age at 17 months 17 Cognition Cognition checked decreased water radial arm maze test water radial arm maze: WMI errors maximum working memory load yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 1.5300000 1.2800000 0.22 0.19 mean number SE 0.6600000 0.5026927 NA NA NA NA NA 9 7 fig2J NA NA 78
Koebele 2023 70 20 20 late middle age at 17 months 17 Cognition Cognition checked decreased water radial arm maze test water radial arm maze:delayed memory retention number of errors yes Sham Female Ratus ratus Rat Fischer 344 CDF no Laboratory No 5 months 22.00 2.0900000 1.3500000 0.347 0.66 mean number SE 1.0410000 1.7461959 NA NA NA NA NA 9 7 fig2J NA NA 79
Itoh et al 2023 139 59 59 12-14 months 13 Cognition Cognition extracted Increased Y maze testing Y maze testing Yes unclear Female Mus musculus Mice C57BL6 no NA NA 2 months old 8.00 57.1200000 46.1700000 53.06(lower)72.71 (upper) 39.45(lower)50.19(upper_ median percentage spontaneous alteration IQR 14.9657273 8.1797411 19.650 10.74 NA NA NA 13 16 Fig 2 NA NA 80
Zakeri et al 2019 148 63 63 23 months 23 Cognition Cognition extracted Increased Y maze testing Y maze testing Yes Sham Female Mus musculus Mice NMRI no Laboratory No 10 months 43.00 68.5712498 23.4193649 5.259502581 8.499296105 mean percentage spontaneous alteration S.E.M 11.7606053 19.0050039 NA NA NA NA NA 5 5 Fig 4 NA NA 81
Zakeri et al 2019 149 64 63 23 months 23 Cognition Cognition extracted Increased Y maze testing Y maze testing Yes intact Female Mus musculus Mice NMRI no Laboratory No 10 months 43.00 63.7760050 23.4193649 13.33583607 8.499296105 mean percentage spontaneous alteration S.E.M 26.6716721 19.0050039 NA NA NA NA NA 4 5 Fig 4 NA NA 82
Heinze-Milne 2021 57 50 50 18 months 18 Frailty assessment Frailty extracted decreased Frailty score Frailty score yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 4 weeks 4.00 0.2239073 0.1773100 0.036645285 0.04081906 mean frailty score 95% confidence interval (whole interval) 0.0093483 0.0104130 NA NA NA NA NA 10 11 fig 2 extracted mean and CI from figure sham points: .287, .255, .246, .206,.19; points OX .22, .19, .17, .15, .12, .05, .18, .2, .23 but points # don't tally to n=10 or 11 83
de la Fuente 2004 30 34 34 18 months 18 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; IL2 axillary leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 435.4564033 52.2479564 95.74250681 12.07425068 mean pg/ml Sd 95.7425068 12.0742507 NA NA NA NA NA 6 6 Fig 7b IL2 production mostly from T cellsin axi and spleen ChatGpt why does it say chat gtp in adjacent cell 84
de la Fuente 2004 31 34 34 22 months 22 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; IL2 axillary leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 213.7772480 51.7540872 55.05790191 20.45299728 mean pg/ml Sd 55.0579019 20.4529973 NA NA NA NA NA 6 4 Fig 7b IL2 production mostly from T cellsin axi and spleen ChatGpt why does it say chat gtp in adjacent cell 85
de la Fuente 2004 32 34 34 24 months 24 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; IL2 spleen leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 367.5408719 139.8160763 76.72002725 44.85694823 mean pg/ml Sd 76.7200272 44.8569482 NA NA NA NA NA 6 5 Fig 7b NA NA 86
de la Fuente 2004 27 34 34 18 months 18 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; Stimulation axillary leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 446.5245870 180.4184182 215.661355 69.21497703 mean index Sd 215.6613550 69.2149770 NA NA NA NA NA 6 6 Fig 7a Stim on ConA specific to Tcells in axi and spleen ChatGpt NA 87
de la Fuente 2004 28 34 34 22 months 22 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; Stimulation axillary leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 141.7538371 138.0877896 54.25750318 92.28663603 mean index Sd 54.2575032 92.2866360 NA NA NA NA NA 6 4 Fig 7a Stim on ConA specific to Tcells in axi and spleen ChatGpt NA 88
de la Fuente 2004 29 34 34 24 months 24 Immune Function Immune Function reextracted Increased T cell function test T cells function test in vitro; Stimulation axillary leu w/ConA yes Sham Female Ratus ratus Rat wistar no NA NA 12 months 52.00 584.5146153 438.9480888 182.2270017 185.4531235 mean index Sd 182.2270017 185.4531235 NA NA NA NA NA 6 5 Fig 7a Stim on ConA specific to Tcells in axi and spleen ChatGpt NA 89
Apelo 2020 2 7 7 12 months 12 activity, energetics and metabolism Metabolism Yes Increased Energy expenditure energy expenditure dark yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 19.5500000 15.1600000 1.071 0.94 mean kcal/kg/hr SEM 3.3867994 2.9725410 NA NA NA NA NA 10 10 fig 4 Just dark period data used as this is when animals are active Mice WT of Rictor flox mice 90
Apelo 2020 4 8 8 12 months 12 activity, energetics and metabolism Metabolism Yes Increased Energy expenditure energy expenditure dark yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 14.7600000 14.8900000 0.66 0.8 mean kcal/kg/hr SEM 2.1889724 2.5298221 NA NA NA NA NA 11 10 fig 4 Just dark period data used as this is when animals are active Mice WT of Rictor flox mice 91
Garratt et al 2017 142 30 30 22 months 22 activity, energetics and metabolism Metabolism extracted decreased Glucose tolerance glucose tolerance area under the cruve Yes Sham Male Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 9337.9349020 9880.6440420 981.8162399 676.3504312 mean abituary units SEM 2776.9956840 2029.0512940 NA NA NA NA NA 8 9 Fig 5 NA NA 92
Garratt et al 2017 143 31 31 22 months 22 activity, energetics and metabolism Metabolism extracted decreased Glucose tolerance glucose tolerance area under the cruve Yes Sham Female Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 7309.0000000 8483.0000000 281.1 557.9 mean abituary units SEM 843.3000000 1932.6222910 NA NA NA NA NA 9 12 Fig 5 NA NA 93
Borbelyova et al 2017 144 61 61 18 months 18 activity, energetics and metabolism Metabolism extracted decreased Glucose tolerance glucose tolerance area under the cruve Yes Sham Male Ratus ratus Rat Lewis no NA NA 30 days 4.00 203.4000000 216.2000000 212.15 226.78 mean abituary units SEM 1081.7569900 962.1460550 NA NA NA NA NA 26 18 Fig 3A NA NA 94
Apelo 2020 5 7 7 12 months 12 activity, energetics and metabolism Metabolism extracted decreased Insulin sensitivity Insulin tolerance test yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 5102.0000000 4895.0000000 206 187 mean abitrary units (AUC) SEM 600.5880452 545.1940022 NA NA 8 to 9 8 to 9 NA 9 9 fig 5 supplement 1 NA Mice WT of Rictor flox mice 95
Apelo 2020 6 8 8 13 months 13 activity, energetics and metabolism Metabolism extracted decreased Insulin sensitivity Insulin tolerance test yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 5567.0000000 5380.0000000 192 378 mean abitrary units (AUC) SEM 559.7713819 1102.0499080 NA NA 7 to 10 7 to 10 NA 9 9 fig 5 supplement 1 NA Mice WT of Rictor flox mice 96
Garratt 2018 44 30 30 22-24 months 23 skeletal Muscle function Muscle size checked Increased Quadriceps size quadriceps size yes Sham Male Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 0.1230000 0.1460000 0.005 0.007 mean g SEM 0.0187083 0.0252389 NA NA NA NA NA 14 13 fig5 got exact sample sizes from data files NA 97
Garratt 2018 47 31 31 22-24 months 23 skeletal Muscle function Muscle size checked Increased Quadriceps size quadriceps size yes Sham Female Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 0.1180000 0.1110000 0.004 0.006 mean g SEM 0.0132665 0.0216333 NA NA NA NA NA 11 13 fig5 got exact sample sizes from data files NA 98
Garratt 2018 45 30 30 22-24 months 23 skeletal Muscle function Muscle size checked Increased Skeletal muscle fiber size fiber CSA yes Sham Male Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 2153.0000000 2461.0000000 70 108 mean um2 SEM 252.3885893 418.2822014 NA NA NA NA NA 13 15 fig5 got exact sample sizes from data files NA 99
Garratt 2018 48 31 31 22-24 months 23 skeletal Muscle function Muscle size checked Increased Skeletal muscle fiber size fiber CSA yes Sham Female Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 2130.0000000 2029.0000000 168 93 mean um2 SEM 531.2626469 308.4461055 NA NA NA NA NA 10 11 fig5 got exact sample sizes from data files NA 100
Mason 2011 80 4 4 end of life death Pathology at death NonTumor_pathology checked decreased Cardiac pathology atrial thrombosis at death yes Sham Female Mus musculus Mice CBA/J no Laboratory No 21 days 3.00 0.3800000 0.4400000 NA NA Proportion NA NA NA NA NA NA NA NA NA 34 25 table 1 NA NA 101
Mason 2011 79 4 4 end of life death Pathology at death NonTumor_pathology checked decreased Cardiac pathology cardiac fibrosis at death yes Sham Female Mus musculus Mice CBA/J no Laboratory No 21 days 3.00 0.4100000 0.8400000 NA NA Proportion NA NA NA NA NA NA NA NA NA 34 25 table 1 NA NA 102
Mason 2011 78 4 4 end of life death Pathology at death NonTumor_pathology checked decreased Cardiac pathology cardiomyopathy at death yes Sham Female Mus musculus Mice CBA/J no Laboratory No 21 days 3.00 0.7300000 0.5800000 NA NA Proportion NA NA NA NA NA NA NA NA NA 30 24 table 1 NA NA 103
Holand 1977 196 76 76 At death death Pathology at death NonTumor_pathology extracted decreased Cardiac pathology atrial thrombosis yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.2290000 0.1280000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 104
Holand 1977 198 76 76 At death death Pathology at death NonTumor_pathology extracted decreased Cardiac pathology Valvular endocarditis (heart inflammation disorder) yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.1100000 0.0370000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals Metritis and otitis media are also listed in paper but not in search protocol (V similar between groups) 105
Drori and Folman 1976 167 68 68 End of life death Pathology at death NonTumor_pathology extracted decreased Kidney pathology Proportion with Nephritis yes intact Male Ratus ratus Rat Albino no NA NA 41 days 6.00 0.2500000 0.2390000 NA NA proportion NA NA NA NA NA NA NA NA NA 48 46 Table 3 Other pathologies (pneumonia and enteritis) are listed but not included in healthspan search protocol NA 106
Holand 1977 195 76 76 At death death Pathology at death NonTumor_pathology extracted decreased Kidney pathology Severe glomerulosclerosis yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.4500000 0.6700000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 107
Holand 1977 197 76 76 At death death Pathology at death NonTumor_pathology extracted decreased Polyarteritis Polyarteritis yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.0280000 0.0680000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 108
Drori and Folman 1976 166 68 68 End of life death Pathology at death Tumor_nonmammory extracted decreased Proportion with tumors Proportion with tumors (eccept hypophyseal adenoma) yes intact Male Ratus ratus Rat Albino no NA NA 41 days 6.00 0.1040000 0.0870000 NA NA proportion NA NA NA NA NA NA NA NA NA 48 46 Table 3 Other pathologies (pneumonia and enteritis) are listed but not included in healthspan search protocol NA 109
hewitson 2012 60 3 3 12 months 12 Pathology cross sectional NonTumor_pathology checked decreased Kidney pathology kidney fibrosis (relative collagen conc) yes Sham Male Mus musculus Mice RlnWT no Laboratory No 4 weeks 4.00 0.9990000 1.0000000 0.041 0.024 mean % SEM 0.1004291 0.0587878 NA NA NA NA NA 6 6 fig2C NA NA 110
Urbieta 2012 117 9 9 18-22 months 20 pathology cross sectional NonTumor_pathology checked decreased Kidney pathology kidney fibrosis yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 6 months 26.00 2.4700000 2.7500000 0.4 0.3 mean % cortical area SE 1.3266499 0.9949874 NA NA NA NA NA 11 11 fig4 NA NA 111
Urbieta 2012 115 9 9 18-22 months 20 pathology cross sectional NonTumor_pathology checked Increased Kidney pathology presence of kidney lesions (higher score better) yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 6 months 26.00 6.9000000 6.5000000 0.6 0.6 mean #/field SE 1.9899749 1.9899749 NA NA NA NA NA 11 11 text NA NA 112
Urbieta 2012 116 9 9 18-22 months 20 pathology cross sectional NonTumor_pathology checked decreased Kidney pathology presence of kidney lesions segmental glomerulosclerosis yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 6 months 26.00 2.0000000 2.2000000 0.4 0.5 mean %glomerular score SE 1.3266499 1.6583124 NA NA NA NA NA 11 11 text NA NA 113
Reckelhoff 1993 109 13 13 18-20 months 19 Pathology cross sectional NonTumor_pathology checked Increased Kidney pathology presence of kidney lesions (higher score better) yes intact Female Ratus ratus Rat wistar no Laboratory No 10 weeks 10.00 91.0000000 92.0000000 2 1 mean proportion of normal glomerular SEM (assumed) 4.4721360 2.0000000 NA NA NA NA NA 5 4 text Information is provided on severity of damage also, but not sure how to extract this and the SE . Stated that it is more severe in males NA 114
Reckelhoff 1993 110 14 14 18-20 months 19 Pathology cross sectional NonTumor_pathology checked Increased Kidney pathology presence of kidney lesions yes intact Male Ratus ratus Rat wistar no Laboratory No 10 weeks 10.00 83.0000000 92.0000000 2 2 mean proportion of normal glomerular SEM (assumed) 5.2915026 3.4641016 NA NA NA NA NA 7 3 text NA NA 115
Herrara et al 2020 128 30 30 25 months 25 Pathology cross sectional NonTumor_pathology extracted decreased Liver pathology Hepatic lipidosis Yes Sham Male Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 2.2857000 1.5385000 0.4738 0.4178 mean score SEM 1.7728105 1.5063966 NA NA NA NA NA 14 13 unpublished data Data that was unpublished from Herrara et al. Pathology method included in paper for sham animals NA 116
Herrara et al 2020 129 30 30 25 months 25 Pathology cross sectional NonTumor_pathology extracted decreased Liver pathology Hepatic sum all other pathologies Yes Sham Male Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 1.7143000 1.6923000 0.5687 0.5687 mean score SEM 2.1277858 2.0503857 NA NA NA NA NA 14 13 unpublished data Data that was unpublished from Herrara et al. Pathology method included in paper for sham animals NA 117
Herrara et al 2020 130 31 31 25 months 25 Pathology cross sectional NonTumor_pathology extracted decreased Liver pathology Hepatic lipidosis Yes Sham Female Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 1.5714000 1.1250000 0.3738 0.3400 mean score SEM 1.3985864 1.3601471 NA NA NA NA NA 14 16 unpublished data Data that was unpublished from Herrara et al. Pathology method included in paper for sham animals NA 118
Herrara et al 2020 131 31 31 25 months 25 Pathology cross sectional NonTumor_pathology extracted decreased Liver pathology Hepatic sum all other pathologies Yes Sham Female Mus musculus Mice Het3 no Laboratory No 7-8 weeks 7.50 1.0000000 0.8750000 0.3631 0.2562 mean score SEM 1.3587324 1.0246951 NA NA NA NA NA 14 16 unpublished data Data that was unpublished from Herrara et al. Pathology method included in paper for sham animals NA 119
Phelan 1995 162 65 65 At death or 27 months if still alive 27 Pathology cross sectional NonTumor_pathology extracted Increased total non-neoplastic lesions average number of non-neoplastic lesions Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 7.1000000 7.0000000 1.1 0.7 mean number of lesions S.E 4.1158231 2.5238859 NA NA NA NA NA 14 13 Table 6, chapter 6 lots of info on specific lesions in table 5 67 animals examined. Doesn’t state which specific groups so have assumed t was spread evenly across five groups 120
Wang 2021 122 53 53 14-15months 14.5 sensory function Sensory function checked Increased Smell preference odor smell preference test for female urine versus control yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 8months 35.00 7.6700000 9.0800000 1.9 1.1 mean index SEM 5.3740115 3.1112698 NA NA NA NA NA 8 8 fig 5m NA NA 121
Wang 2021 127 54 54 18 month 18 sensory function Sensory function checked Increased Smell preference odor smell preference test for female urine versus control Yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 8 months 35.00 6.6192971 5.9996651 1.469891624 1.318452595 mean min S.E.M 4.1574813 3.7291471 NA NA NA NA NA 8 8 Fig s3I NA NA 122
Lazenby 1993 73 15 15 24 months 24 sensory function Sensory function checked decreased vision presence of cataracts vision cataracts yes intact Female Ratus ratus Rat albino Wistar derived no Laboratory No 5 weeks 5.00 0.1400000 0.0000000 NA NA proportion NA NA NA NA NA NA NA NA NA 1111 56 text not sure if the sample size for controls is overestimated because they say how many were studied in total but not how many studied at old age NA 123
Lazenby 1993 74 16 16 24 months 24 sensory function Sensory function checked decreased vision presence of cataracts vision cataracts yes intact Male Ratus ratus Rat albino Wistar derived no Laboratory No 5 weeks 5.00 0.0400000 0.0000000 NA NA proportion NA NA NA NA NA NA NA NA NA 1111 54 text not sure if the sample size for controls is overestimated because they say how many were studied in total but not how many studied at old age NA 124
Phelan 1995 155 65 65 14 months old 14 skeletal Muscle function Strength/balance extracted Increased balance on a dowel balance on a dowel Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 82.0603081 67.6986504 11.42083219 10.97037099 mean seconds S.E 44.2326929 42.4880641 NA NA NA NA NA 15 15 fig 4a chapter 6 NA NA 125
Phelan 1995 156 65 65 20 months old 20 skeletal Muscle function Strength/balance extracted Increased balance on a dowel balance on a dowel Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 47.1015357 61.2281183 8.155435963 5.723542117 mean seconds S.E 31.5858677 22.1671833 NA NA NA NA NA 15 15 fig 4a chapter 6 NA NA 126
Phelan 1995 157 65 65 26 months old 26 skeletal Muscle function Strength/balance extracted Increased balance on a dowel balance on a dowel Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 14.1761035 48.2608021 5.19790461 9.237139482 mean seconds S.E 20.1313980 35.7752874 NA NA NA NA NA 15 15 fig 4a chapter 6 NA NA 127
Garratt 2021 51 33 33 675 to 800 days 24.5 skeletal Muscle function Strength/balance checked Increased Grip strength grip strength hanging yes intact Male Mus musculus Mice C57Bl6/J no Laboratory No 7 weeks 7.00 29.8100000 32.6900000 2.63 3 mean sec SEM 13.9166519 15.8745079 NA NA NA NA NA 28 28 Fig 2 Also data available for mixed sex environment but as this is the only sample point I have excluded NA 128
Zakeri et al 2019 150 63 63 23 months 23 skeletal Muscle function Strength/balance extracted Increased Grip strength Wire hang test Yes Sham Female Mus musculus Mice NMRI no Laboratory No 10 months 43.00 26.1990000 5.6870000 5.193 1.822 mean seconds S.E.M 11.6119010 4.0741159 NA NA NA NA NA 5 5 Fig 4 NA NA 129
Zakeri et al 2019 151 64 63 23 months 23 skeletal Muscle function Strength/balance extracted Increased Grip strength Wire hang test Yes intact Female Mus musculus Mice NMRI no Laboratory No 10 months 43.00 22.4114736 5.6870000 1.004 1.822 mean seconds S.E.M 2.0080000 4.0741159 NA NA NA NA NA 4 5 Fig 4 NA NA 130
Phelan 1995 159 65 65 12 months old 12 skeletal Muscle function Strength/balance extracted Increased Grip strength Hang time on tread Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 137.8000000 104.2000000 24.4 18.5 mean hang time, sec S.E 77.1595749 58.5021367 NA NA NA NA NA 10 10 Table 3, chapter 6 NA NA 131
Phelan 1995 160 65 65 18 months old 18 skeletal Muscle function Strength/balance extracted Increased Grip strength Hang time on tread Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 15.6000000 20.4000000 5.2 6.2 mean hang time, sec S.E 18.0133284 21.4774300 NA NA NA NA NA 12 12 Table 3, chapter 6 NA NA 132
Perez 1989 93 27 27 24 months 24 skeletal Muscle function Strength/balance checked Increased rotarod rotarod acceleration 4th trial yes Sham Male Ratus ratus Rat sprague-Dawley no Laboratory No 24h 0.14 6.2400000 24.7500000 1.34 10.49 mean seconds SEM 5.3600000 39.2499860 NA NA NA NA NA 16 14 fig2 NA NA 133
Garratt 2018 46 30 30 22-24 months 23 skeletal Muscle function Strength/balance checked Increased rotarod grip strengthrotarod yes Sham Male Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 48.2100000 71.5900000 7.79 13.88 mean sec SEM 29.1475110 53.7570088 NA NA NA NA NA 14 15 fig5 got exact sample sizes from data files NA 134
Garratt 2018 49 31 31 22-24 months 23 skeletal Muscle function Strength/balance checked Increased rotarod grip strengthrotarod yes Sham Female Mus musculus Mice UM-Het3 no Laboratory No 3 months 12.00 63.6500000 57.0000000 12.63 9.37 mean sec SEM 47.2571328 37.4800000 NA NA NA NA NA 14 16 fig5 got exact sample sizes from data files NA 135
Wang 2021 123 54 54 18 month 18 skeletal Muscle function Strength/balance checked Increased rotarod rotarod Yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 8 months 35.00 21.9600000 25.1500000 1.97 2.45 mean m S.E.M 5.5720014 6.9296465 NA NA NA NA NA 8 8 Fig S3B NA NA 136
Wang 2021 120 53 53 14-15months 14.5 skeletal Muscle function Strength/balance checked Increased Treamill Treatmill coordination yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 8months 35.00 3.1480000 3.9570000 0.199 0.284 mean min SEM 0.5628570 0.8032733 NA NA NA NA NA 8 8 fig5h NA NA 137
Wang 2021 119 53 53 14-15months 14.5 skeletal Muscle function Strength/balance checked Increased Treamill Treadmill running yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 8months 35.00 2.1500000 3.0800000 0.2 0.233 mean joule SEM 0.5656854 0.6590235 NA NA NA NA NA 8 8 fig 5G NA NA 138
Wang 2021 124 54 54 18 month 18 skeletal Muscle function Strength/balance checked Increased Treamill Treadmill running Yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 8 months 35.00 1.2800000 1.3200000 0.17 0.13 mean J S.E.M 0.4808326 0.3676955 NA NA NA NA NA 8 8 FigS3C NA NA 139
Wang 2021 125 54 54 18 month 18 skeletal Muscle function Strength/balance checked Increased Treamill Treatmill coordination Yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 8 months 35.00 2.2700000 2.3300000 0.26 0.32 mean min S.E.M 0.7353911 0.9050967 NA NA NA NA NA 8 8 FigS3D NA NA 140
Phelan 1995 158 65 65 28 months old 28 skeletal Muscle function Strength/balance checked Increased Treamill Max running speed on treadmill Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 25.7000000 30.3000000 1.8 1.7 mean m/min S.E 5.6920998 5.3758720 NA NA NA NA NA 10 10 p180 NA NA 141
Mason 2011 81 4 4 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary lesion at death yes Sham Female Mus musculus Mice CBA/J no Laboratory No 21 days 3.00 0.0590000 0.0000000 NA NA Proportion NA NA NA NA NA NA NA NA NA 34 25 table 1 NA NA 142
Hotchkiss 1995 61 26 26 at presentation or necropsy death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes intact Female Ratus ratus Rat sprague-Dawley no Laboratory No 90 days 13.00 0.4170000 0.0830000 NA NA Proportion proportion NA NA NA NA NA NA NA NA 12 12 Fig 3 state that in intact animals the presence of mammory tumors was positively correlated with survival, i.e. These did not cause death NA 143
durbin 1966 35 28 28 At some point over life death Pathology at death Tumor_mammory checked. Changed to proportion decreased Mammary pathology mammary tumor incidence oophorectomy intact Female Ratus ratus Rat CD no Laboratory No 77days 11.00 0.6520000 0.0390000 n/a n/a Proportion % NA NA NA NA NA NA NA NA 46 45 table 2 &1 for n NA NA 144
pilgrim1957 102 53 53 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes intact Female Mus musculus Mice C3H/HeCRGL no Laboratory No 3 months 12.00 0.9200000 0.6200000 NA NA Proportion NA NA NA NA NA NA NA NA NA 39 37 table 1 NA NA 145
pilgrim1957 103 54 53 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes intact Female Mus musculus Mice C3H/HeCRGL no Laboratory No 4 months 16.00 0.9200000 0.7200000 NA NA Proportion NA NA NA NA NA NA NA NA NA 39 39 table 1 NA NA 146
pilgrim1957 104 55 53 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes intact Female Mus musculus Mice C3H/HeCRGL no Laboratory No 5 months 22.00 0.9200000 0.7300000 NA NA Proportion NA NA NA NA NA NA NA NA NA 39 37 table 1 NA NA 147
planas silva 2008 105 56 54 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes Sham Female Ratus ratus Rat sprague-Dawley no Laboratory No 1 month 4.00 1.0000000 0.0000000 NA NA Proportion NA NA NA NA NA NA NA NA NA 12 6 fig4A NA NA 148
planas silva 2008 106 57 54 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes intact Female Ratus ratus Rat sprague-Dawley no NA NA 1 month 4.00 1.0000000 0.0000000 NA NA Proportion NA NA NA NA NA NA NA NA NA 6 6 fig4A and text NA NA 149
planas silva 2008 107 58 55 end of life death Pathology at death Tumor_mammory checked decreased Mammary pathology mammary tumor incidence yes Sham Female Ratus ratus Rat sprague-Dawley no NA NA 4.5 months 4.50 1.0000000 0.1430000 NA NA Proportion NA NA NA NA NA NA NA NA NA 7 7 Fig4B and text NA NA 150
Holand 1977 192 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased Adrenal-Cortical adenoma Adrenal-Cortical adenoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.0090000 0.0642000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 151
Holand 1977 191 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased Harderian adenoma Harderian adenoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.0090000 0.0490000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 152
Pullinger and Head 1964 183 72 72 At death death Pathology at death Tumor_nonmammory extracted decreased Liver pathology Percentage hepatoma yes intact Female Mus musculus Mice C3Hf no NA NA 56 to 111 days of age 12.00 0.2450000 0.2500000 NA NA Proportion NA NA NA NA NA NA NA NA NA 110 32 Table 1 Data is available for breeding females and castrated males, but not relevant control or matched sterilized group NA 153
Holand 1977 189 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased nonthymic lymphosarcoma nonthymic lymphosarcoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.1280000 0.0390000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 154
Holand 1977 190 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased nonthymic lymphosarcoma nonthymic lymphosarcoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.1280000 0.0390000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 155
Hotchkiss 1995 62 26 26 at necrospy death Pathology at death Tumor_nonmammory checked decreased pituitary tumors pituitary tumors yes intact Female Ratus ratus Rat sprague-Dawley no Laboratory No 90 days 13.00 0.7500000 0.0000000 NA NA Proportion proportion NA NA NA NA NA NA NA NA 8 12 table 1 NA NA 156
Holand 1977 193 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased pituitary tumors Pituitary adenoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.0830000 0.0280000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 157
Drori and Folman 1976 168 68 68 End of life death Pathology at death Tumor_nonmammory extracted decreased Proportion with hypophyseal adenoma Proportion with hypophyseal adenoma yes intact Male Ratus ratus Rat Albino no NA NA 41 days 6.00 0.0850000 0.2170000 NA NA proportion NA NA NA NA NA NA NA NA NA 48 46 Table 3 Other pathologies (pneumonia and enteritis) are listed but not included in healthspan search protocol NA 158
Apelo 2020 7 7 7 At death death Pathology at death Tumor_nonmammory Yes decreased Proportion with tumors Proportion of animals with cancer at death yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 0.5000000 0.5900000 NA NA Proportion percent with cancer NA NA NA NA NA NA NA NA 22 17 fig 5 supplement 1 NA Mice WT of Rictor flox mice 159
Apelo 2020 8 8 8 At death death Pathology at death Tumor_nonmammory Yes decreased Proportion with tumors Proportion of animals with cancer at death yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 0.4200000 0.4800000 NA NA Proportion percent with cancer NA NA NA NA NA NA NA NA 12 21 fig 5 supplement 1 NA Mice WT of Rictor flox mice 160
storer 1982 111 17 17 end of life death Pathology at death Tumor_nonmammory checked decreased Proportion with tumors all sites tumours thymic lymphomas exckluded yes intact Female Mus musculus Mice balb c no Laboratory No 50 days 7.00 0.9040000 0.8530000 NA NA Proportion NA NA NA NA NA NA NA NA NA 831 326 table 1 and 3 Data is available for lots of individual tumor sites NA 161
storer 1982 113 18 18 end of life death Pathology at death Tumor_nonmammory checked decreased Proportion with tumors all sites tumours thymic lymphomas exckluded yes intact Female Mus musculus Mice RFM no Laboratory No 50 days 7.00 0.7620000 0.7710000 NA NA Proportion NA NA NA NA NA NA NA NA NA 745 337 table4, 6 Data is available for lots of individual tumor sites NA 162
pullinger 1961 108 59 59 end of life death Pathology at death Tumor_nonmammory extracted decreased Pulmonary adenoma pulmonary adenoma yes intact Female Mus musculus Mice C3Hf no NA NA 57 to 67 days 9.00 0.1270000 0.0625000 NA NA Proportion NA NA NA NA NA NA NA NA NA 110 32 End of text for exp 3 results section some other pathologies are listed but not included in protocol NA 163
Holand 1977 194 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased Pulmonary adenoma Pulmonary adenoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.2480000 0.3400000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 164
Holand 1977 188 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased Reticulum cell sarcoma Reticulum cell sarcoma yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.5970000 0.6500000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 165
durbin 1966 36 28 29 At some point over life death Pathology at death Tumor_nonmammory checked. Changed to proportion decreased superficial skin and subcutaneous tumor not mammary superficial skin and subcutaneous tumor not mammary oophorectomy intact Female Ratus ratus Rat CD no Laboratory No 77days 11.00 0.0547445 0.1363636 NA NA Proportion number NA NA NA NA NA NA NA NA 548 44 table 4 excluded data for other skin tumors because control group is not comparable? NA 166
storer 1982 112 17 17 end of life death Pathology at death Tumor_nonmammory checked decreased thymic lymphomas thymic lymphomas yes intact Female Mus musculus Mice balb c no Laboratory No 50 days 7.00 0.0140000 0.0210000 NA NA Proportion NA NA NA NA NA NA NA NA NA 831 326 table 1 and 3 Data is available for lots of individual tumor sites NA 167
storer 1982 114 18 18 end of life death Pathology at death Tumor_nonmammory checked decreased thymic lymphomas thymic lymphomas yes intact Female Mus musculus Mice RFM no Laboratory No 50 days 7.00 0.0950000 0.0270000 NA NA Proportion NA NA NA NA NA NA NA NA NA 745 337 table 2 Data is available for lots of individual tumor sites NA 168
Holand 1977 187 76 76 At death death Pathology at death Tumor_nonmammory extracted decreased thymic lymphomas thymic lymphomas yes intact Female Mus musculus Mice RFMf/Wg no NA NA 5-6 weeks 5.50 0.1650000 0.0780000 NA NA Proportion NA NA NA NA NA NA NA NA NA 109 103 Table 3 Only using data from non-irradiated animals NA 169
Andervont 1950 184 73 73 15 months 15 Pathology cross sectional Tumor_nonmammory extracted decreased Liver pathology Percentage hepatoma yes intact Male Mus musculus Mice C3H no NA NA 30-70 days of age 14.00 0.1200000 0.0000000 NA NA Proportion NA NA NA NA NA NA NA NA NA 38 36 Table 1 NA NA 170
Andervont 1950 185 74 74 15 months 15 Pathology cross sectional Tumor_nonmammory extracted decreased Liver pathology Percentage hepatoma yes intact Male Mus musculus Mice C3H no NA NA 30-70 days of age, plus 9 up to 160 days old 14.00 0.2700000 0.1800000 NA NA Proportion NA NA NA NA NA NA NA NA NA 86 60 Table 1 NA NA 171
Andervont 1950 186 75 75 15 months 15 Pathology cross sectional Tumor_nonmammory extracted decreased Liver pathology Percentage hepatoma yes intact Male Mus musculus Mice CBA/J no NA NA 30-70 days of age, plus 4 up to 160 days old 14.00 0.2900000 0.2000000 NA NA Proportion NA NA NA NA NA NA NA NA NA 48 32 Table 1 NA NA 172
Phelan 1995 161 65 65 At death or 27 months if still alive 27 Pathology cross sectional Tumor_nonmammory extracted Increased Proportion with tumors average number of neoplastic lesions Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 2.3000000 1.2000000 0.5 0.2 mean number of lesions S.E 1.8708287 0.7211103 NA NA NA NA NA 14 13 Table 6, chapter 6 lots of info on specific lesions in table 5 67 animals examined. Doesn’t state which specific groups so have assumed t was spread evenly across five groups 173
Borbelyova et al 2016 133 77 77 30 months 30 activity, energetics and metabolism Voluntary activity extracted Increased Open field test Open field rearing Yes unclear Male Ratus ratus Rat wistar albino no Laboratory No Day 47 6.50 1.7093772 2.1870866 0.622591267 0.621445956 means cm S.E.M 2.4112856 2.3252379 NA NA NA NA NA 15 14 Fig 1c NA NA 174
Borbelyova et al 2016 132 77 77 30 months 30 activity, energetics and metabolism Voluntary activity checked Increased Open field test Open field distance moved Yes unclear Male Ratus ratus Rat wistar albino no Laboratory No Day 47 6.50 977.6000000 639.0000000 159.4 115 means cm S.E.M 617.3535454 430.2905995 NA NA NA NA NA 15 14 Fig 1a Do we want to include open field test considering it is in an unfamilar environment? NA 175
Borbelyova et al 2021 136 77 77 30 months 30 activity, energetics and metabolism Voluntary activity checked Increased Open field test Open field distance moved Yes Sham Male Ratus ratus Rat wistar albino no Laboratory No Day 47 6.50 1081.0000000 888.9000000 626.9 456.9 means cm SD 626.9000000 456.9000000 NA NA NA NA NA 7 3 Fig 6 Started with n = 5 for cast but lost 2 during experiment NA 176
Leffa 2013 77 12 12 18 months 18 activity, energetics and metabolism Voluntary activity checked Increased Open field test open field test: number of crossing yes Sham Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 55.6000000 47.9300000 5.68 3.05 medium number SEM 19.6760972 10.5655099 NA NA NA NA NA 12 12 fig3 NA NA 177
Perez 1989 92 27 27 24 months 24 activity, energetics and metabolism Voluntary activity checked Increased Open field test open field test rearing yes Sham Male Ratus ratus Rat sprague-Dawley no Laboratory No 24h 0.14 3.8400000 6.5800000 1.06 1.61 mean number SEM 4.2400000 6.0240684 NA NA NA NA NA 16 14 fig1 Christine had extracted defication boluses but I deletedit as it has nothing to do with activity or ageing NA 178
Perez 1989 91 27 27 24 months 24 activity, energetics and metabolism Voluntary activity checked Increased Open field test open field test segments crossed yes Sham Male Ratus ratus Rat sprague-Dawley no Laboratory No 24h 0.14 25.2200000 42.2600000 3.06 4.32 mean number SEM 12.2400000 16.1639599 NA NA NA NA NA 16 14 fig1 NA NA 179
Domonkos 2017 33 35 35 12 months 12 activity, energetics and metabolism Voluntary activity checked Increased Open field test open field test (total activity) yes Sham Male Ratus ratus Rat Lewis no NA NA 1 month 4.00 9.5400000 9.7800000 0.95 1.39 mean m SEM 4.6540305 6.8095815 NA NA NA NA NA 24 24 Fig 2 NA NA 180
de chaves et al 2009 164 67 67 18 months 18 activity, energetics and metabolism Voluntary activity extracted Increased Open field test Open field distance number of crossings yes Sham Female Ratus ratus Rat wistar no NA NA 3 months 12.00 56.3400000 48.2200000 5.33 3.33 mean crossings SEM 19.5836705 12.2352013 NA NA 12 to 15 12 to 15 NA 14 14 Fig 3 NA NA 181
de chaves et al 2009 165 67 67 18 months 18 activity, energetics and metabolism Voluntary activity extracted Increased Open field test Open field distance rearings yes Sham Female Ratus ratus Rat wistar no NA NA 3 months 12.00 16.0800000 17.1000000 2.37 1.73 mean rearings SEM 8.7079360 6.3564259 NA NA 12 to 15 12 to 15 NA 14 14 Fig 3 NA NA 182
Apelo 2020 1 7 7 12 months 12 activity, energetics and metabolism Voluntary activity Yes Increased Total activity dark period activity dark yes Sham Female Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 32.7000000 20.3100000 4.1 2.55 mean counts (x10 to power 3) SEM 12.9653384 8.0638080 NA NA NA NA NA 10 10 fig 4 Just dark period data used as this is when animals are active Mice WT of Rictor flox mice 183
Apelo 2020 3 8 8 12 months 12 activity, energetics and metabolism Voluntary activity Yes Increased Total activity dark period activity dark yes Sham Male Mus musculus Mice C57Bl6/J no Laboratory No 3.5weeks 3.50 19.3600000 20.6300000 2.54 4.13 mean counts (x10 to power 3) SEM 8.4242270 13.0602067 NA NA NA NA NA 11 10 fig 4 Just dark period data used as this is when animals are active Mice WT of Rictor flox mice 184
Borbelyova et al 2016 135 77 77 30 months 30 activity, energetics and metabolism Voluntary activity checked Increased voluntary activity assessment observation cage distance moved Yes unclear Male Ratus ratus Rat wistar albino no Laboratory No Day 47 6.50 14.2000000 10.2000000 1.6 0.8 means m S.E.M 6.1967734 2.9933259 NA NA NA NA NA 15 14 Fig7A Do we want to include open field test considering it is in an unfamilar environment? NA 185
picazo 2016 98 21 21 13 months 13 activity, energetics and metabolism Voluntary activity extracted Increased voluntary activity assessment spontaneous activity test: rearing yes intact Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 306.3000000 354.5000000 12 22.6 mean number SEM 26.8328157 50.5351363 NA NA NA NA NA 5 5 fig1B NA NA 186
picazo 2016 99 21 21 18 months 18 activity, energetics and metabolism Voluntary activity checked Increased voluntary activity assessment spontaneous activity test: rearing yes intact Female Ratus ratus Rat wistar no Laboratory No 3 months 12.00 343.5000000 318.2000000 12.6 16.8 mean number SEM 28.1744565 37.5659420 NA NA NA NA NA 5 5 fig1B NA NA 187
Domonkos 2017 34 35 35 12 months 12 activity, energetics and metabolism Voluntary activity extracted Increased voluntary activity assessment Total distance moved 30 min (phenotyper) yes Sham Male Ratus ratus Rat Lewis no NA NA 1 month 4.00 0.5910000 0.6800000 0.0696 0.0695 mean m SEM 0.3409690 0.3404791 NA NA NA NA NA 24 24 Fig 2 NA NA 188
Wang 2021 118 53 53 14-15months 14.5 activity, energetics and metabolism Voluntary activity checked Increased voluntary activity assessment locomotion (Assume voluntary?) yes Sham Male Mus musculus Mice C57Bl6/J no NA NA 8months 35.00 26.1500000 39.2200000 2.18 4.79 mean m SEM 6.1659711 13.5481659 NA NA NA NA NA 8 8 fig 5 F NA NA 189
Perez 1989 94 27 27 24 months 24 activity, energetics and metabolism Voluntary activity checked Increased voluntary wheel running runnning wheel percent dark period yes Sham Male Ratus ratus Rat sprague-Dawley no Laboratory No 24h 0.14 77.8000000 83.5500000 2.93 2.15 mean %activity SEM 11.7200000 8.0445634 NA NA NA NA NA 16 14 fig3 NA NA 190
Perez 1989 95 27 27 24 months 24 activity, energetics and metabolism Voluntary activity extracted Increased voluntary wheel running runnning wheel total yes Sham Male Ratus ratus Rat sprague-Dawley no Laboratory No 24h 0.14 3819.1531460 4563.9592400 465.5223585 501.9538979 mean Total counts SEM 1862.0894340 1878.1395100 NA NA NA NA NA 16 14 fig3 NA NA 191
Phelan 1995 152 65 65 14 months old 14 activity, energetics and metabolism Voluntary activity extracted Increased voluntary wheel running voluntary wheel running Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 4.8245627 2.4727543 0.533037655 0.349474053 mean km/day S.E 2.9195675 1.9141482 NA NA NA NA NA 30 30 Fig 3 chapter 6 stated this was measured on all animals. Looked at how many died up to each age point to estimate sample size NA 192
Phelan 1995 153 65 65 20 months old 20 activity, energetics and metabolism Voluntary activity extracted Increased voluntary wheel running voluntary wheel running Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 3.1996265 2.1559313 0.427177101 0.294472083 mean km/day S.E 1.8123589 1.5301218 NA NA NA NA NA 18 27 Fig 3 chapter 6 stated this was measured on all animals. Looked at how many died up to each age point to estimate sample size NA 193
Phelan 1995 154 65 65 26 months old 26 activity, energetics and metabolism Voluntary activity extracted Increased voluntary wheel running voluntary wheel running Yes Sham Female Mus musculus Mice Swiss Webster no Laboratory No weaning 3.00 2.4942007 1.8164948 0.428577681 0.33514728 mean km/day S.E 1.6035908 1.4608731 NA NA NA NA NA 14 19 Fig 3 chapter 6 stated this was measured on all animals. Looked at how many died up to each age point to estimate sample size NA 194
Code
# getting CV2 to get lnRR

dat %>% group_by(Study) %>% 
  summarise(cv2_cont = mean((Error_control_SD/Control_value)^2, na.rm = T), 
            cv2_trt = mean((Error_experimental_SD/Experimental_value)^2, na.rm = T), 
            n_cont = mean(Sample_size_control, na.rm = T), 
            n_trt =  mean(Sample_size_experimental, na.rm = T)) %>% 
  ungroup() %>% 
  summarise(cv2_cont = weighted.mean(cv2_cont, n_cont, na.rm = T), 
            cv2_trt = weighted.mean(cv2_trt, n_trt, na.rm = T)) -> cvs

# lnRR

# survival proportion using arcsin transformation = lnrrp
# using CV
dat$yi <- ifelse(effect_type == "other", lnrrm(dat$Experimental_value,
                                               dat$Control_value, 
                                               dat$Sample_size_experimental, 
                                               dat$Sample_size_control,
                                               cvs[["cv2_trt"]],
                                               cvs[["cv2_cont"]])[[1]],
                                         lnrrp(dat$Experimental_value, 
                                               dat$Control_value, 
                                               dat$Sample_size_experimental, 
                                               dat$Sample_size_control)[[1]])

dat$vi <- ifelse(effect_type == "other", lnrrm(dat$Experimental_value,
                                               dat$Control_value, 
                                               dat$Sample_size_experimental, 
                                               dat$Sample_size_control, 
                                               cvs[["cv2_trt"]],
                                               cvs[["cv2_cont"]])[[2]],
                                         lnrrp(dat$Experimental_value, 
                                               dat$Control_value, 
                                               dat$Sample_size_experimental, 
                                               dat$Sample_size_control)[[2]])

# for plotting without using CV

dat$vi2 <- ifelse(effect_type == "other", lnrrm2(dat$Experimental_value,
                                               dat$Control_value, 
                                               dat$Sample_size_experimental, 
                                               dat$Sample_size_control, 
                                               dat$Error_experimental_SD,
                                               dat$Error_control_SD)[[2]],
                                        lnrrp(dat$Experimental_value, 
                                              dat$Control_value, 
                                              dat$Sample_size_experimental, 
                                              dat$Sample_size_control)[[2]])



# flipping directions

dat$direction <- ifelse(dat$direction.of.improved.health == "Increased", 1, -1)

dat$yi <- dat$yi * dat$direction

15 Meta-analysis

15.1 Main model

Code
# meta-analysis

VCV <- vcalc(vi = vi, 
             cluster = Study, 
             obs = Effect_ID, #subgroup = Measure,
             data = dat, 
             rho = 0.5)

mod <-  rma.mv(yi = yi, 
               V = VCV, 
               random = list(~1|Strain, 
                             ~ 1|Study, 
                             ~ 1|Effect_ID
                             ), 
               data = dat, 
               test = "t",
               sparse = TRUE,
               control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod) 

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-127.4764   254.9528   262.9528   276.0036   263.1656   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0011  0.0336     23     no     Strain 
sigma^2.2  0.0000  0.0001     48     no      Study 
sigma^2.3  0.0774  0.2783    194     no  Effect_ID 

Test for Heterogeneity:
Q(df = 193) = 512.3283, p-val < .0001

Model Results:

estimate      se    tval   df    pval   ci.lb   ci.ub    
  0.1095  0.0498  2.2012  193  0.0289  0.0114  0.2077  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod),5) # almost no phylogenetic effect
    I2_Total    I2_Strain     I2_Study I2_Effect_ID 
    71.19775      1.02545      0.00001     70.17229 
Code
# visualizing the result
orchard_plot(mod, xlab = "log response ratio (lnRR)", group = "Study")

16 Meta-regression

Code
mod1 <-  rma.mv(yi = yi, 
                V = VCV, 
                mod = ~ Sex - 1, 
                random = list(~ 1|Strain, 
                              ~ 1|Study, 
                              ~ 1|Effect_ID), 
                #struct = "DIAG",
                data = dat, 
                test = "t",
                sparse = TRUE,
                control=list(optimizer="optim", optmethod="BFGS")
)
summary(mod1) 

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-126.9820   253.9641   263.9641   280.2516   264.2867   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0041  0.0642     23     no     Strain 
sigma^2.2  0.0000  0.0016     48     no      Study 
sigma^2.3  0.0776  0.2785    194     no  Effect_ID 

Test for Residual Heterogeneity:
QE(df = 192) = 510.4776, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 192) = 2.3418, p-val = 0.0989

Model Results:

           estimate      se    tval   df    pval    ci.lb   ci.ub    
SexFemale    0.0991  0.0595  1.6668  192  0.0972  -0.0182  0.2165  . 
SexMale      0.1349  0.0806  1.6736  192  0.0958  -0.0241  0.2939  . 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# visualizing the result

mod_healthspan_sex <- mod_results(mod1, group = "Study", mod = "Sex", data = dat)

#saveRDS(mod_healthspan_sex, here("Rdata", "fig", "mod_healthspan_sex.rds"))

#mod_healthspan_sex <- readRDS(here("Rdata", "fig", "mod_healthspan_sex.rds"))        
        
orchard_plot(mod_healthspan_sex, mod = "Sex", 
             xlab = "log response ratio (lnRR)", group = "Study", cb = F) # colour = T)

Code
# attr(lm_result, "class") <- NULL

# orchard plot

main <- mod_results(mod, group = "Study")
attr(main, "class") <- NULL
main$mod_table$name <- gsub("Intrcpt", "Overall", main$mod_table$name)
main$mod_table$name <- factor(main$mod_table$name)
main$data$moderator <- gsub("Intrcpt", "Overall", main$data$moderator)
main$data$moderator <- factor(main$data$moderator)

class(main) <- c("orchard", "data.frame")

p_overall <- orchard_plot(main, xlab = "log response ratio (lnRR)", angle = 0, group = "Study") + ylim(-2.2,2)


sex_diff <- mod_results(mod1, mod = "Sex", group = "Study")


p_sex_diff <-orchard_plot(sex_diff, mod = "Sex", 
                          xlab = "log response ratio (lnRR)", group = "Study", angle = 0, cb = F) + ylim(-2.2,2)

combined <- submerge(sex_diff, main)

# changing the name (intercept) to:
# TODO - this should be done in the orchard_plot function
combined$mod_table$name <- gsub("Intrcpt", "Overall", combined$mod_table$name)
combined$mod_table$name <- factor(combined$mod_table$name)

combined$data$moderator <- gsub("Intrcpt", "Overall", combined$data$moderator)


orchard_plot(combined,
             xlab = "log response ratio (lnRR)", group = "Study", angle = 0, cb = F) + 
  scale_colour_manual(values = rev(c("#999999", "#88CCEE", "#CC6677"))) +
  scale_fill_manual(values = rev(c("#999999", "#88CCEE", "#CC6677")))

Code
mod2 <-  rma.mv(yi = yi, 
                V = VCV, 
                mod = ~ Sub.measure - 1, 
                random = list(~ 1|Strain, 
                              ~ 1|Study, 
                              ~ 1|Effect_ID), 
                data = dat, 
                test = "t",
                sparse = TRUE,
                control=list(optimizer="optim", optmethod="BFGS")
)
summary(mod2) 

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-108.0054   216.0108   248.0108   299.1868   251.3279   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0113  0.1061     23     no     Strain 
sigma^2.2  0.0000  0.0016     48     no      Study 
sigma^2.3  0.0616  0.2483    194     no  Effect_ID 

Test for Residual Heterogeneity:
QE(df = 181) = 419.9578, p-val < .0001

Test of Moderators (coefficients 1:13):
F(df1 = 13, df2 = 181) = 2.5436, p-val = 0.0031

Model Results:

                                       estimate      se     tval   df    pval 
Sub.measureCardiac function/pathology   -0.0291  0.1873  -0.1552  181  0.8769 
Sub.measureCardiac size                  0.1325  0.1712   0.7738  181  0.4401 
Sub.measureCognition                     0.2027  0.1581   1.2816  181  0.2016 
Sub.measureFrailty                       0.3243  0.6384   0.5080  181  0.6121 
Sub.measureImmune Function              -1.0856  0.6389  -1.6992  181  0.0910 
Sub.measureMetabolism                   -0.0135  0.2586  -0.0521  181  0.9585 
Sub.measureMuscle size                   0.1732  0.3513   0.4931  181  0.6225 
Sub.measureNonTumor_pathology            0.0066  0.1039   0.0640  181  0.9491 
Sub.measureSensory function              0.3828  0.2681   1.4276  181  0.1551 
Sub.measureStrength/balance              0.3398  0.1634   2.0788  181  0.0390 
Sub.measureTumor_mammory                 0.5965  0.1439   4.1464  181  <.0001 
Sub.measureTumor_nonmammory              0.0381  0.0781   0.4873  181  0.6266 
Sub.measureVoluntary activity           -0.1880  0.1383  -1.3595  181  0.1757 
                                         ci.lb   ci.ub      
Sub.measureCardiac function/pathology  -0.3987  0.3406      
Sub.measureCardiac size                -0.2054  0.4703      
Sub.measureCognition                   -0.1094  0.5147      
Sub.measureFrailty                     -0.9354  1.5840      
Sub.measureImmune Function             -2.3462  0.1750    . 
Sub.measureMetabolism                  -0.5238  0.4969      
Sub.measureMuscle size                 -0.5199  0.8664      
Sub.measureNonTumor_pathology          -0.1984  0.2117      
Sub.measureSensory function            -0.1462  0.9118      
Sub.measureStrength/balance             0.0173  0.6622    * 
Sub.measureTumor_mammory                0.3126  0.8804  *** 
Sub.measureTumor_nonmammory            -0.1161  0.1922      
Sub.measureVoluntary activity          -0.4608  0.0849      

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# visualizing the result
orchard_plot(mod2, mod = "Sub.measure", 
             xlab = "log response ratio (lnRR)", group = "Study", angle = 45)

Code
# Measure x Sex
# need to name up Sub.measure
dat$Sub.measure <- factor(dat$Sub.measure, 
                          levels = levels(dat$Sub.measure),
                          labels = c("Cardiac\nfunction/\npathology", "Cardiac size", "Cognition", "Frailty",
                                     "Immune\nfunction", "Metabolism", "Muscle size", "Non-tumor\npathology",
                                     "Sensory\nfunction", "Strength/\nbalance", "Tumor\nmammory", "Tumor\nnonmammory",
                                     "Voluntary\nactivity"))


dat$MesSex <- paste0(dat$Sub.measure, "_", dat$Sex)

dat$Measurement.type <- factor(dat$Measurement.type,
                           levels = levels(as.factor(dat$Measurement.type)),
                           labels = levels(as.factor(dat$Measurement.type))
                           )


mod3 <-  rma.mv(yi = yi, 
                 V = vi, 
                 mod = ~ MesSex - 1, 
                 random = list(~ 1|Strain, 
                               ~ 1|Study, 
                               ~ 1|Effect_ID), 
                 data = dat, 
                 test = "t",
                 sparse = TRUE,
                 control=list(optimizer="optim", optmethod="BFGS")
)

summary(mod3)

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-113.8147   227.6294   279.6294   361.3126   289.3794   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0323  0.1797     23     no     Strain 
sigma^2.2  0.0000  0.0015     48     no      Study 
sigma^2.3  0.0474  0.2177    194     no  Effect_ID 

Test for Residual Heterogeneity:
QE(df = 171) = 250.4550, p-val < .0001

Test of Moderators (coefficients 1:23):
F(df1 = 23, df2 = 171) = 1.8556, p-val = 0.0140

Model Results:

                                            estimate      se     tval   df 
MesSexCardiac\nfunction/\npathology_Female    0.0070  0.2308   0.0304  171 
MesSexCardiac\nfunction/\npathology_Male     -0.0104  0.1820  -0.0574  171 
MesSexCardiac size_Female                     0.1699  0.2052   0.8278  171 
MesSexCardiac size_Male                       0.1279  0.1647   0.7769  171 
MesSexCognition_Female                       -0.0766  0.1549  -0.4947  171 
MesSexCognition_Male                          0.4879  0.2396   2.0357  171 
MesSexFrailty_Male                            0.3398  0.6288   0.5404  171 
MesSexImmune\nfunction_Female                -1.0961  0.3740  -2.9309  171 
MesSexMetabolism_Female                      -0.0847  0.3806  -0.2226  171 
MesSexMetabolism_Male                        -0.0016  0.2996  -0.0052  171 
MesSexMuscle size_Female                     -0.0847  0.4576  -0.1851  171 
MesSexMuscle size_Male                        0.1371  0.4204   0.3262  171 
MesSexNon-tumor\npathology_Female            -0.0568  0.1184  -0.4795  171 
MesSexNon-tumor\npathology_Male               0.1456  0.2273   0.6408  171 
MesSexSensory\nfunction_Female                0.8268  0.4130   2.0021  171 
MesSexSensory\nfunction_Male                  0.1313  0.3246   0.4045  171 
MesSexStrength/\nbalance_Female               0.0486  0.2320   0.2093  171 
MesSexStrength/\nbalance_Male                 0.3393  0.2214   1.5322  171 
MesSexTumor\nmammory_Female                   0.6855  0.1592   4.3046  171 
MesSexTumor\nnonmammory_Female                0.0097  0.0965   0.1001  171 
MesSexTumor\nnonmammory_Male                  0.0866  0.1453   0.5956  171 
MesSexVoluntary\nactivity_Female             -0.3630  0.2093  -1.7342  171 
MesSexVoluntary\nactivity_Male                0.0080  0.1755   0.0454  171 
                                              pval    ci.lb    ci.ub      
MesSexCardiac\nfunction/\npathology_Female  0.9758  -0.4487   0.4627      
MesSexCardiac\nfunction/\npathology_Male    0.9543  -0.3696   0.3488      
MesSexCardiac size_Female                   0.4089  -0.2352   0.5750      
MesSexCardiac size_Male                     0.4383  -0.1972   0.4531      
MesSexCognition_Female                      0.6214  -0.3823   0.2291      
MesSexCognition_Male                        0.0433   0.0148   0.9609    * 
MesSexFrailty_Male                          0.5896  -0.9015   1.5811      
MesSexImmune\nfunction_Female               0.0038  -1.8342  -0.3579   ** 
MesSexMetabolism_Female                     0.8241  -0.8360   0.6666      
MesSexMetabolism_Male                       0.9958  -0.5929   0.5898      
MesSexMuscle size_Female                    0.8534  -0.9879   0.8185      
MesSexMuscle size_Male                      0.7447  -0.6927   0.9670      
MesSexNon-tumor\npathology_Female           0.6322  -0.2905   0.1770      
MesSexNon-tumor\npathology_Male             0.5225  -0.3030   0.5943      
MesSexSensory\nfunction_Female              0.0469   0.0116   1.6419    * 
MesSexSensory\nfunction_Male                0.6863  -0.5094   0.7720      
MesSexStrength/\nbalance_Female             0.8344  -0.4094   0.5065      
MesSexStrength/\nbalance_Male               0.1273  -0.0978   0.7764      
MesSexTumor\nmammory_Female                 <.0001   0.3711   0.9998  *** 
MesSexTumor\nnonmammory_Female              0.9204  -0.1808   0.2001      
MesSexTumor\nnonmammory_Male                0.5522  -0.2003   0.3734      
MesSexVoluntary\nactivity_Female            0.0847  -0.7761   0.0502    . 
MesSexVoluntary\nactivity_Male              0.9638  -0.3385   0.3544      

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# visualizing the result

orchard_plot(mod3, mod = "MesSex", 
             xlab = "log response ratio (lnRR)", group = "Study", angle = 0, cb = F)

Code
# figures


# some experiments 

res3 <- mod_results(mod3, mod = "MesSex", group = "Study")

mod_table_m <- res3$mod_table[c(2,4,6, 7, 10, 12, 14, 16, 18, 21, 23), ]
mod_table_f <- res3$mod_table[c(1,3,5, 8, 9, 11, 13, 15, 17, 19, 20, 22), ]

data_m <- res3$data[ !is.na(match(res3$data$moderator, mod_table_m$name)), ]
data_f <- res3$data[ !is.na(match(res3$data$moderator, mod_table_f$name)), ]
  
res3_male <- list(mod_table = mod_table_m, data = data_m)
res3_female <- list(mod_table = mod_table_f, data = data_f)

# changing names
# male
res3_male$mod_table$name <- gsub("_Male", "", res3_male$mod_table$name)
res3_male$mod_table$name <- factor(res3_male$mod_table$name)

res3_male$data$moderator <- gsub("_Male", "", res3_male$data$moderator)

# female
res3_female$mod_table$name <- gsub("_Female", "", res3_female$mod_table$name)
res3_female$mod_table$name <- factor(res3_female$mod_table$name)

res3_female$data$moderator <- gsub("_Female", "", res3_female$data$moderator)

class(res3_male) <- c("orchard", "data.frame")
class(res3_female) <- c("orchard", "data.frame")





p_male <- orchard_plot(res3_male, mod = "MesSex", 
             xlab = "log response ratio (lnRR)", group = "Study", angle = 0, cb = F) + labs(title = "Male") + ylim(-2.2,2)


# p_male <- p_male + plot_annotation(title = "Male",
#                          theme = theme(plot.title = element_text(size = 20)))

p_female <- orchard_plot(res3_female, mod = "MesSex", 
             xlab = "log response ratio (lnRR)", group = "Study", angle = 0, cb = F) + labs(title = "Female") + ylim(-2.2,2)

# p_female <- p_female + plot_annotation(title = "Female",
#                          theme = theme(plot.title = element_text(size = 20)))

p_overall + p_sex_diff + p_female + p_male +  plot_layout(widths = c(2, 2), heights = c(1,2.5)) 


# creating a forest plot using dat

str(dat)

# selecting

fdat <- dat %>% select(Study, Measure, Effect_ID, Measurement.type, Sub.measure, yi, vi)

# add lower.ci and upper.ci

fdat <- dat %>% mutate(lower.ci = yi - 1.96*sqrt(vi), upper.ci = yi + 1.96*sqrt(vi))

# p_forest <- ggplot(data = fdat, aes(x = yi, y = Measurement.type)) +
#   geom_errorbarh(aes(xmin = lower.ci, xmax = upper.ci, colour = Sub.measure), 
#                  height = 1, show.legend = TRUE, size = 1, alpha = 0.8, position = position_dodge2(width = 1)) +
#   geom_point(aes(col = Sub.measure), fill = "white", size = 2, shape = 21, position =position_dodge2(width = 1)) +
#   geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
#   geom_vline(xintercept = mod$b, linetype = 2, colour = "red", alpha = 0.3) +
#   labs(x = "lnRR (effect size)", y = "")

fdat$Measurement.type <- factor(
  fdat$Measurement.type,
  levels = unique(fdat$Measurement.type)
)

dodge <- position_dodge2(width = 0.6, preserve = "single")

p_forest <- ggplot(data = fdat, aes(x = yi, y = Measurement.type)) +
  geom_errorbarh(
    aes(xmin = lower.ci, xmax = upper.ci, colour = Sub.measure), 
    height = 0.3,
    position = dodge,
    size = 1, alpha = 0.8
  ) +
  geom_point(
    aes(colour = Sub.measure),
    fill = "white",
    shape = 21,
    size = 2,
    position = dodge
  ) +
  geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
  geom_vline(xintercept = mod$b, linetype = 1, linewidth = 2, colour = "red", alpha = 0.3) +
  scale_y_discrete(expand = c(0,0)) +
  # Rename legend title
  scale_colour_discrete(name = "Sub-measure") +
  labs(x = "lnRR (effect size)", y = "") +
  theme_minimal() +
  # Place legend below plot
  theme(
    legend.position = "bottom",
    axis.text.y = element_text(size = 9)
  )

p_forest

########################
# different drawing .... 
########################

# meta-analytic mean

res <- mod_results(mod, group = "Study", data = dat)[[1]]

saveRDS(res, here("Rdata", "fig", "res.rds"))

# example....
dat$MestypeSex <- paste0(dat$Measurement.type, "_", dat$Sex)

hdat <- escalc(yi = yi, vi = vi2, data = dat)

hdat$es_ID <- factor(1:nrow(hdat))

# MesSex
idat <- aggregate(x = hdat, cluster = MesSex, obs = es_ID, rho = 0)

# MestypeSex

jdat <- aggregate(x = hdat, cluster = MestypeSex, obs = es_ID, rho = 0)

jdat$MestypeSex


# # adding non-aggredated ones
# cdat <- rbind(cdat, bdat[bdat$MesSex == "Frailty_Male", ], bdat[bdat$MesSex == "Sensory\nfunction_Female", ])
# 
# # replacing vi with vi2
# cdat$vi[cdat$MesSex == "Frailty_Male"] <- cdat$vi2[cdat$MesSex == "Frailty_Male"]
# cdat$vi[cdat$MesSex == "Sensory\nfunction_Female"] <- cdat$vi2[cdat$MesSex == "Sensory\nfunction_Female"]
# 
dim(dat)
dim(idat)
dim(jdat)

# CI1
idat$lower.ci <- idat$yi - sqrt(idat$vi) * qnorm(0.975) 
idat$upper.ci <- idat$yi + sqrt(idat$vi) *  qnorm(0.975)

jdat$lower.ci <- jdat$yi - sqrt(jdat$vi) * qnorm(0.975) 
jdat$upper.ci <- jdat$yi + sqrt(jdat$vi) *  qnorm(0.975)




# adding more informaition
idat %>% select(Sub.measure, yi, lower.ci, upper.ci, Sex) -> kdat
# adding more informaition
jdat %>% select(Measurement.type, yi, lower.ci, upper.ci, Sex) -> ldat

addition <- data.frame(Sub.measure = "Overall", yi =  NA, lower.ci = NA, upper.ci = NA, Sex = "Female")
addition1 <- data.frame(Measurement.type = "Overall", yi =  NA, lower.ci = NA, upper.ci = NA, Sex = "Female")


kdat <- rbind(kdat, addition)
ldat <- rbind(ldat, addition1)

# removing sensory function and immune function from kdat

# saving these data
saveRDS(kdat, here("Rdata", "fig", "kdat.rds"))
saveRDS(ldat, here("Rdata", "fig", "ldat.rds"))

####### Start here

res <- readRDS(here("Rdata", "fig", "res.rds"))
kdat <- readRDS(here("Rdata", "fig", "kdat.rds"))
ldat <- readRDS(here("Rdata", "fig", "ldat.rds"))


sum_data <- data.frame("x.diamond" = c(res$lowerCL,
                                       res$estimate ,
                                       res$upperCL,
                                       res$estimate ),
                       "y.diamond" = c(1,
                                       1 + 0.25,
                                       1,
                                       1 - 0.25)
)

# plotting Sub.measure
# looking at 
#dat$Sub.measure 
kdat$Sub.measure <- factor(kdat$Sub.measure,
                          levels = c( "Overall", 
                                      "Cardiac\nfunction/\npathology", 
                                      "Cardiac size", 
                                      "Cognition", 
                                      "Frailty",
                                      "Immune\nfunction", 
                                      "Metabolism", 
                                      "Muscle size", 
                                      "Non-tumor\npathology",
                                      "Sensory\nfunction", 
                                      "Strength/\nbalance",
                                      "Tumor\nmammory", 
                                      "Tumor\nnonmammory",
                                      "Voluntary\nactivity"),
                          labels = c("Overall", 
                                     "Cardiac\nfunction/\npathology", 
                                     "Cardiac size", 
                                     "Cognition", 
                                     "Frailty",
                                     "Immune\nfunction", 
                                     "Metabolism", 
                                     "Muscle size", 
                                     "Non-tumor\npathology",
                                     "Sensory\nfunction", 
                                     "Strength/\nbalance",
                                     "Tumor\nmammory", 
                                     "Tumor\nnonmammory",
                                     "Voluntary\nactivity"))

mes_sex <- ggplot(data = kdat, aes(x = yi, y = Sub.measure)) +
  geom_errorbarh(aes(xmin = lower.ci, xmax = upper.ci, colour = Sex), 
                 height = 0, show.legend = TRUE, size = 4.5, 
                 alpha = 0.8, position =position_dodge(width = 0.75)) +
  geom_point(aes(col = Sex), fill = "white", size = 2, shape = 21, position =position_dodge2(width = 0.75)) +
  geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
  geom_vline(xintercept = res$estimate, linetype = 1, colour = "red", alpha = 0.3) +
  xlim(-1.6, 1.6) +
  #creating 95% prediction intervals
  geom_segment(data = res, ggplot2::aes(x = lowerPR, y = 1, xend = upperPR, yend = 1, group = name)) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data, ggplot2::aes(x = x.diamond, y = y.diamond), fill = "red") +
  
  theme_bw() +
  scale_color_manual(values = c("#CC6677", "#88CCEE")) +
  labs(x = "lnRR (effect size)", y = "", colour = "Sex") +
  theme(legend.position = c(0.95, 0.85),
        legend.justification = c(1, 0)) +
  theme(legend.title = element_text(size = 9)) +
  #theme(legend.direction="horizontal") +
  theme(axis.text.y = element_blank()) +
  theme(axis.text.y = element_text(size = 10, colour ="black",
                                   hjust = 0.5)) 


# icons 

filenames <- list.files(here("icons", "literature"), pattern=".png", full.names=TRUE)
ldf <- lapply(filenames, readPNG)
names(ldf) <- substr(filenames, 99, 99+60)

mes_sex1 <- mes_sex +
  annotation_custom(rasterGrob(ldf$Mus_musculus.png), xmin = -2, xmax = -1, ymin = 12, ymax = 13.5) +
  annotation_custom(rasterGrob(ldf$Rattus_argentiventer.png), xmin = -1.5, xmax = -0.5, ymin = 11.5, ymax = 13)

mes_sex1

###

mes_sex2 <- ggplot(data = kdat, aes(x = yi, y = Sub.measure)) +
  geom_errorbarh(aes(xmin = lower.ci, xmax = upper.ci, colour = Sex), 
                 height = 0, show.legend = TRUE, size = 4.5, 
                 alpha = 0.8, position =position_dodge(width = 0.75)) +
  geom_point(aes(col = Sex), fill = "white", size = 2, shape = 21, position =position_dodge2(width = 0.75)) +
  geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
  geom_vline(xintercept = res$estimate, linetype = 1, colour = "red", alpha = 0.3) +
   coord_cartesian(xlim = c(-0.5, 0.7)) +
  #creating 95% prediction intervals
  geom_segment(data = res, ggplot2::aes(x = lowerPR, y = 1, xend = upperPR, yend = 1, group = name)) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data, ggplot2::aes(x = x.diamond, y = y.diamond), fill = "red") +
  
  theme_bw() +
  scale_color_manual(values = c("#CC6677", "#88CCEE")) +
  labs(x = "lnRR (effect size)", y = "", colour = "Sex") +
  theme(legend.position = c(0.95, 0.85),
        legend.justification = c(1, 0)) +
  theme(legend.title = element_text(size = 9)) +
  #theme(legend.direction="horizontal") +
  theme(axis.text.y = element_blank()) +
  theme(axis.text.y = element_text(size = 10, colour ="black",
                                   hjust = 0.5)) 
# icons
mes_sex21 <- mes_sex2 +
  annotation_custom(rasterGrob(ldf$Mus_musculus.png), xmin = -0.5, xmax = -0.25, ymin = 12, ymax = 13.5) +
  annotation_custom(rasterGrob(ldf$Rattus_argentiventer.png), xmin = -0.3, xmax = -0.05, ymin = 11.5, ymax = 13)

mes_sex21

# the version with arrows

library(dplyr)

kdat <- kdat %>%
  mutate(
    lower.truncated = lower.ci < -0.5,
    upper.truncated = upper.ci > 0.7
  )

ggplot(data = kdat, aes(x = yi, y = Sub.measure)) +
  geom_errorbarh(aes(xmin = pmax(lower.ci, -0.5), 
                     xmax = pmin(upper.ci, 0.7), 
                     colour = Sex), 
                 height = 0, show.legend = TRUE, size = 4.5, 
                 alpha = 0.8, position = position_dodge(width = 0.75)) +
  
  geom_point(aes(col = Sex), fill = "white", size = 2, shape = 21, position = position_dodge2(width = 0.75)) +
  
  geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
  geom_vline(xintercept = res$estimate, linetype = 1, colour = "red", alpha = 0.3) +
  
  # Add left arrows
  geom_text(data = subset(kdat, lower.truncated),
            aes(x = -0.5, label = "<", y = Sub.measure),
            position = position_dodge(width = 0.75),
            vjust = -0.5, size = 6, colour = "black") +
  
  # Add right arrows
  geom_text(data = subset(kdat, upper.truncated),
            aes(x = 0.7, label = ">", y = Sub.measure),
            position = position_dodge(width = 0.75),
            vjust = -0.5, size = 6, colour = "black") +
  
  coord_cartesian(xlim = c(-0.5, 0.7)) +
  
  geom_segment(data = res, aes(x = lowerPR, y = 1, xend = upperPR, yend = 1, group = name)) +
  geom_polygon(data = sum_data, aes(x = x.diamond, y = y.diamond), fill = "red") +
  
  theme_bw() +
  scale_color_manual(values = c("#CC6677", "#88CCEE")) +
  labs(x = "lnRR (effect size)", y = "", colour = "Sex") +
  
  theme(
    legend.position = c(0.95, 0.85),
    legend.justification = c(1, 0),
    legend.title = element_text(size = 9),
    axis.text.y = element_text(size = 10, colour = "black", hjust = 0.5)
  )


## need to do a version for Measurement.type

#gdat$S
ldat$Measurement.type <- factor(ldat$Measurement.type,
                                
                           levels = c("Overall",
  # Survival & Frailty
  "Frailty score",
  "Energy expenditure",
  "voluntary activity assessment",
  "voluntary wheel running",
  "Total activity dark period",
  
  # Cardiac
  "Ejection fraction",
  "fractional shortening",
  "cardiac fibrosis",
  "Cardiac pathology",
  "Cardiomyocyte size",
  "E/A ratio",
  "Heart size",
  "Left Ventricular Isovolumic Relaxation Time",
  "left ventricle size",
  
  # Cognitive & Behavioral
  "Morris water maze",
  "Barnes maze test",
  "water radial arm maze test",
  "Y maze testing",
  "RAM memory test",
  "novel object recognition",
  "Autoshaping learning test",
  "inhibitory avoidance test",
  "T maze test",
  "Open field test",
  "balance on a dowel",
  "rotarod",
  "Treamill",
  
  # Muscle
  "Grip strength",
  "Skeletal muscle fiber size",
  "Quadriceps size",
  
  # Metabolic
  "Glucose tolerance",
  "Insulin sensitivity",
  
  # Immune & Tumors
  "T cell function test",
  "nonthymic lymphosarcoma",
  "Mammary pathology",
  "pituitary tumors",
  "Pulmonary adenoma",
  "Reticulum cell sarcoma",
  "Polyarteritis",
  "Proportion with tumors ",
  "Proportion with hypophyseal adenoma",
  "Harderian adenoma",
  "Adrenal-Cortical adenoma",
  "thymic lymphomas",
  "superficial skin and subcutaneous tumor not mammary",
  "total non-neoplastic lesions",
  
  # Organ-specific
  "Liver pathology",
  "Kidney pathology",
  
  # Sensory
  "vision presence of cataracts",
  "Smell preference"
),

labels =c("Overall",
  # Survival & Frailty
  "Frailty score",
  "Energy expenditure",
  "Voluntary activity assessment",
  "Voluntary wheel running",
  "Total activity dark period",
  
  # Cardiac
  "Ejection fraction",
  "Fractional shortening",
  "Cardiac fibrosis",
  "Cardiac pathology",
  "Cardiomyocyte size",
  "E/A ratio",
  "Heart size",
  "Left ventricular isovolumic relaxation time",
  "Left ventricle size",
  
  # Cognitive & Behavioral
  "Morris water maze",
  "Barnes maze test",
  "Water radial arm maze test",
  "Y maze testing",
  "RAM memory test",
  "Novel object recognition",
  "Autoshaping learning test",
  "Inhibitory avoidance test",
  "T maze test",
  "Open field test",
  "Balance on a dowel",
  "Totarod",
  "Treadmill",
  
  # Muscle
  "Grip strength",
  "Skeletal muscle fiber size",
  "Quadriceps size",
  
  # Metabolic
  "Glucose tolerance",
  "Insulin sensitivity",
  
  # Immune & Tumors
  "T cell function test",
  "Nonthymic lymphosarcoma",
  "Mammary pathology",
  "Pituitary tumors",
  "Pulmonary adenoma",
  "Reticulum cell sarcoma",
  "Polyarteritis",
  "Proportion with tumors ",
  "Proportion with hypophyseal adenoma",
  "Harderian adenoma",
  "Adrenal-Cortical adenoma",
  "thymic lymphomas",
  "Superficial skin and subcutaneous tumor not mammary",
  "Total non-neoplastic lesions",
  
  # Organ-specific
  "Liver pathology",
  "Kidney pathology",
  
  # Sensory
  "Vision presence of cataracts",
  "Smell preference"
)
                           # levels = c("Overall",
                           #            "Adrenal-Cortical adenoma",
                           #            "Autoshaping learning test",
                           #            "balance on a dowel",
                           #            "Barnes maze test",
                           #            "cardiac fibrosis",
                           #            "Cardiac pathology",
                           #            "Cardiomyocyte size",
                           #            "E/A ratio",
                           #            "Ejection fraction",
                           #            "Energy expenditure",
                           #            "fractional shortening",
                           #            "Frailty score",
                           #            "Glucose tolerance",
                           #            "Grip strength",
                           #            "Harderian adenoma",
                           #            "Heart size",
                           #            "inhibitory avoidance test",
                           #            "Insulin sensitivity",
                           #            "Kidney pathology",
                           #            "left ventricle size",
                           #            "Left Ventricular Isovolumic Relaxation Time",
                           #            "Liver pathology",
                           #            "Mammary pathology",
                           #            "Morris water maze",
                           #            "nonthymic lymphosarcoma",
                           #            "novel object recognition",
                           #            "Open field test",
                           #            "pituitary tumors",
                           #            "Polyarteritis",
                           #            "Proportion with hypophyseal adenoma",
                           #            "Proportion with tumors ",
                           #            "Pulmonary adenoma",
                           #            "Quadriceps size",
                           #            "RAM memory test",
                           #            "Reticulum cell sarcoma",
                           #            "rotarod",
                           #            "Skeletal muscle fiber size",
                           #            "Smell preference",
                           #            "superficial skin and subcutaneous tumor not mammary",
                           #            "T cell function test",
                           #            "T maze test",
                           #            "thymic lymphomas",
                           #            "Total activity dark period",
                           #            "total non-neoplastic lesions",
                           #            "Treamill",
                           #            "vision presence of cataracts",
                           #            "voluntary activity assessment",
                           #            "voluntary wheel running",
                           #            "water radial arm maze test",
                           #            "Y maze testing"),
                           #    labels = c("Overall",
                           #               "Adrenal-cortical adenoma",
                           #               "Autoshaping learning test",
                           #               "Balance on a dowel",
                           #               "Barnes maze test",
                           #               "Cardiac fibrosis",
                           #               "Cardiac pathology",
                           #               "Cardiomyocyte size",
                           #               "E/A ratio",
                           #               "Ejection fraction",
                           #               "Energy expenditure",
                           #               "Fractional shortening",
                           #               "Frailty score",
                           #               "Glucose tolerance",
                           #               "Grip strength",
                           #               "Harderian adenoma",
                           #               "Heart size",
                           #               "Inhibitory avoidance test",
                           #               "Insulin sensitivity",
                           #               "Kidney pathology",
                           #               "left ventricle size",
                           #               "Left ventricular isovolumic relaxation time",
                           #               "Liver pathology",
                           #               "Mammary pathology",
                           #               "Morris water maze",
                           #               "Nonthymic lymphosarcoma",
                           #               "Novel object recognition",
                           #               "Open field test",
                           #               "Pituitary tumors",
                           #               "Polyarteritis",
                           #               "Proportion with hypophyseal adenoma",
                           #               "Proportion with tumors",
                           #               "Pulmonary adenoma",
                           #               "Quadriceps size",
                           #               "RAM memory test",
                           #               "Reticulum cell sarcoma",
                           #               "Rotarod",
                           #               "Skeletal muscle fiber size",
                           #               "Smell preference",
                           #               "Superficial skin and subcutaneous tumor not mammary",
                           #               "T cell function test",
                           #               "T maze test",
                           #               "Thymic lymphomas",
                           #               "Total activity dark period",
                           #               "Total non-neoplastic lesions",
                           #               "Treamill",
                           #               "Vision presence of cataracts",
                           #               "Voluntary activity assessment",
                           #               "voluntary wheel running",
                           #               "Water radial arm maze test",
                           #               "Y maze testing")
                           )

mestype_sex <- ggplot(data = ldat, aes(x = yi, y = Measurement.type)) +
  geom_errorbarh(aes(xmin = lower.ci, xmax = upper.ci, colour = Sex), 
                 height = 0, show.legend = TRUE, linewidth = 2, 
                 alpha = 0.8, position =position_dodge(width = 0.75)) +
  geom_point(aes(col = Sex), fill = "white", size = 2, shape = 21, position =position_dodge2(width = 0.75)) +
  geom_vline(xintercept = 0, linetype = 2, colour = "black", alpha = 0.3) +
  geom_vline(xintercept = res$estimate, linetype = 1, colour = "red", alpha = 0.3) +
  xlim(-4, 3) +
  #creating 95% prediction intervals
  geom_segment(data = res, ggplot2::aes(x = lowerPR, y = 1, xend = upperPR, yend = 1, group = name)) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data, ggplot2::aes(x = x.diamond, y = y.diamond), fill = "red") +
  
  theme_bw() +
  scale_color_manual(values = c("#CC6677", "#88CCEE")) +
  labs(x = "lnRR (effect size)", y = "", colour = "Sex") +
  theme(legend.position = c(0.95, 0.85),
        legend.justification = c(1, 0)) +
  theme(legend.title = element_text(size = 9)) +
  #theme(legend.direction="horizontal") +
  theme(axis.text.y = element_blank()) +
  theme(axis.text.y = element_text(size = 10, colour ="black",
                                   hjust = 0.5)) 

mestype_sex

# icons 

filenames <- list.files(here("icons", "literature"), pattern=".png", full.names=TRUE)
ldf <- lapply(filenames, readPNG)
names(ldf) <- substr(filenames, 99, 99+60)

mestype_sex1 <- mestype_sex +
  annotation_custom(rasterGrob(ldf$Mus_musculus.png), xmin = -1.5*2.5, xmax = -1*2.5, ymin = 13.5*3.5, ymax = 14.5*3.5) +
  annotation_custom(rasterGrob(ldf$Rattus_argentiventer.png), xmin = -1*2.5, xmax = -0.5*2.5, ymin = 13*3.5, ymax = 14*3.5)

mestype_sex1

17 Publication bais & sensitivity analysis

Code
# raw funnel plot
# funnel plot - 
funnel(mod)

Code
funnel(mod3)

Code
dat$Effective_N <- 1/dat$Sample_size_experimental + 1/dat$Sample_size_control

egger_hs <-  rma.mv(yi = yi, 
                 V = vi, 
                 mod = ~sqrt(Effective_N), 
                 random = list(~ 1|Strain, 
                               ~ 1|Study, 
                               ~ 1|Effect_ID), 
                 data = dat, 
                 test = "t",
                 sparse = TRUE,
                 control=list(optimizer="optim", optmethod="BFGS")
)

summary(egger_hs)

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-140.8768   281.7537   291.7537   308.0412   292.0763   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0242  0.1557     23     no     Strain 
sigma^2.2  0.0000  0.0011     48     no      Study 
sigma^2.3  0.0603  0.2456    194     no  Effect_ID 

Test for Residual Heterogeneity:
QE(df = 192) = 344.7464, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 192) = 0.6690, p-val = 0.4144

Model Results:

                   estimate      se     tval   df    pval    ci.lb   ci.ub    
intrcpt              0.1636  0.1072   1.5255  192  0.1288  -0.0479  0.3751    
sqrt(Effective_N)   -0.2555  0.3124  -0.8179  192  0.4144  -0.8717  0.3607    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
dat$Year <- as.numeric(str_extract(as.character(dat$Study),"[:digit:][:digit:][:digit:][:digit:]"))

decline <-  rma.mv(yi = yi, 
                 V = vi, 
                 mod = ~ Year, 
                 random = list(~ 1|Strain, 
                               ~ 1|Study, 
                               ~ 1|Effect_ID), 
                 data = dat, 
                 test = "t",
                 sparse = TRUE,
                 control=list(optimizer="optim", optmethod="BFGS")
)

summary(decline)

Multivariate Meta-Analysis Model (k = 194; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
-140.0392   280.0784   290.0784   306.3659   290.4010   

Variance Components:

            estim    sqrt  nlvls  fixed     factor 
sigma^2.1  0.0220  0.1484     23     no     Strain 
sigma^2.2  0.0000  0.0011     48     no      Study 
sigma^2.3  0.0585  0.2418    194     no  Effect_ID 

Test for Residual Heterogeneity:
QE(df = 192) = 328.9033, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 192) = 2.7164, p-val = 0.1010

Model Results:

         estimate      se     tval   df    pval    ci.lb    ci.ub    
intrcpt    6.8728  4.1175   1.6692  192  0.0967  -1.2485  14.9941  . 
Year      -0.0034  0.0021  -1.6482  192  0.1010  -0.0075   0.0007    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# The function for leave-one-study-out

dat$Study <- as.factor(dat$Study)

LeaveOneOut_effectsize <- list()
for(i in 1:length(levels(dat$Study))){
  dat1 <- dat[dat$Study != levels(dat$Study)[i], ]
  
  LeaveOneOut_effectsize[[i]] <- rma.mv(yi = yi, 
                 V = vi, 
                 random = list(~ 1|Strain, 
                               ~ 1|Study, 
                               ~ 1|Effect_ID), 
                 data = dat1, 
                 test = "t",
                 sparse = TRUE,
                 control=list(optimizer="optim", optmethod="BFGS")
  )
                 
}


# writing function for extracting est, ci.lb, and ci.ub from all models
est.func <- function(mod){
  df <- data.frame(est = mod$b, lower = mod$ci.lb, upper = mod$ci.ub)
  return(df)
}

#using dplyr to form data frame
MA_LOO <- lapply(LeaveOneOut_effectsize, function(x) est.func(x))%>% bind_rows %>% mutate(left_out = levels(dat$Study))


saveRDS(MA_LOO,file = here("Rdata", "literature","MA_LOO2.rds"))
Code
#telling ggplot to stop reordering factors
MA_LOO <- readRDS(file = here("Rdata",  "literature", "MA_LOO2.rds"))

MA_LOO$left_out<- as.factor(MA_LOO$left_out)
MA_LOO$left_out<-factor(MA_LOO$left_out, levels = MA_LOO$left_out)


#plotting
leaveoneout_E <- ggplot(MA_LOO) +
  geom_hline(yintercept = 0, lty = 2, lwd = 1) +
  geom_hline(yintercept = mod$ci.lb, lty = 3, lwd = 0.75, colour = "black") +
  geom_hline(yintercept = mod$b, lty = 1, lwd = 0.75, colour = "black") +
  geom_hline(yintercept = mod$ci.ub, lty = 3, lwd = 0.75, colour = "black") +
  geom_pointrange(aes(x = left_out, y = est, ymin = lower, ymax = upper)) +
  xlab("Study left out") + 
  ylab("lnRR, 95% CI") + 
  coord_flip() +
  theme(panel.grid.minor = element_blank())+
  theme_bw() + theme(panel.grid.major = element_blank()) +
  theme(panel.grid.minor.x = element_blank() ) +
  theme(axis.text.y = element_text(size = 6))

leaveoneout_E

18 PART III: LIFESPAN ANALYSIS ON ZOO DATA

19 Data preparation & processing

Code
# main data
dat0 <- read_csv(here("data", "zoo", "resultsBaSTApost2005oldFormatFeb2025.csv"), na = c("", "NA"), show_col_types = FALSE)

# phylogeny
load(here("Rdata", "zoo", "maxCredTree.RData"))

tree <- maxCred 

# taxonomy
tax <- read.csv(here("data", "zoo", "FinalTranslTab.csv"))

dat0 %>% left_join(tax, by = c("species" = "ZIMSspecies")) -> dat_full

# talking out species with no data (Pseudocheirus peregrinus = likely to be mistaks in data)
dat_full %>% 
  # filter(
  # species != "Chrysocyon brachyurus" &
  #                   species != "Crocuta crocuta" &
  #                   species != "Neofelis nebulosa" &
  #                   species != "Panthera uncia" &
  #                   species != "Pseudocheirus peregrinus") %>% 
  mutate(phylogeny = gsub(" ", "_", vertlifeSpecies)) -> dat

# adding Cervus canadensis
# dat$vertlifeSpecies[which(dat$species == "Cervus canadensis")] <-"Cervus canadensis"
# dat$phylogeny[which(dat$species == "Cervus canadensis")] <-"Cervus_canadensis"

# fixing species name
#dat$species[dat$species == "Equus asinus"] <- "Equus_africanus"
dat$species[dat$species == "Aonyx cinereus"] <- "Aonyx cinerea"
#dat$species[dat$species == "Bubalus bubalis"] <- "Bubalus arnee"


# life span data 
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% unique(dat$phylogeny)))]

tree <- drop.tip(tree, to_drop)

# checking the number of spp
#length(tree$tip.label)
tree <- as.ultrametric(tree)

#tree <- compute.brlen(tree)
cor_tree <- vcv(tree, corr = TRUE)
Code
##############################################
# data sets comparing normal vs. contraception 
##############################################

# male surgical

dat_m_surg <- dat %>% filter(is.na(Male_Surgical_Contra_Mean) == FALSE, is.na(Male_Surgical_NoContra_Mean) == FALSE) %>% 
  mutate(M_control_m = Male_Surgical_NoContra_Mean,
         M_control_sd = sqrt(Male_Surgical_NoContra_N)*Male_Surgical_NoContra_SE,
         M_control_n = Male_Surgical_NoContra_N,
         M_surgical_m = Male_Surgical_Contra_Mean,
         M_surgical_sd = sqrt(Male_Surgical_Contra_N)*Male_Surgical_Contra_SE,
         M_surgical_n = Male_Surgical_Contra_N,
         sex = "male",
         type = "surgical")

dat_m_surg <- escalc("ROM", 
              m1i = M_surgical_m,
              m2i = M_control_m,
              sd1i = M_surgical_sd,
              sd2i = M_control_sd,
              n1i = M_surgical_n,
              n2i = M_control_n,
              data = dat_m_surg,
              )

#  male hormonal
dat_m_horm <- dat %>% filter(is.na(Male_Hormonal_Contra_Mean) == FALSE, is.na(Male_Hormonal_NoContra_Mean) == FALSE) %>% 
  mutate(M_control_m = Male_Hormonal_NoContra_Mean,
         M_control_sd = sqrt(Male_Hormonal_NoContra_N)*Male_Hormonal_NoContra_SE,
         M_control_n =Male_Hormonal_NoContra_N,
         M_hormonal_m = Male_Hormonal_Contra_Mean,
         M_hormonal_sd = sqrt(Male_Hormonal_Contra_SE)*Male_Hormonal_Contra_N,
         M_hormonal_n = Male_Hormonal_Contra_N,
         sex = "male",
         type = "hormonal")

dat_m_horm <- escalc("ROM", 
                     m1i = M_hormonal_m,
                     m2i = M_control_m,
                     sd1i = M_hormonal_sd,
                     sd2i = M_control_sd,
                     n1i = M_hormonal_n,
                     n2i = M_control_n,
                     data = dat_m_horm,
)


# female hormonal data 

dat_f_horm <- dat %>% filter(is.na(Female_Hormonal_Contra_Mean) == FALSE, is.na(Female_Hormonal_NoContra_Mean) == FALSE) %>% 
  mutate(F_control_m = Female_Hormonal_NoContra_Mean,
         F_control_sd = sqrt(Female_Hormonal_NoContra_N)*Female_Hormonal_NoContra_SE,
         F_control_n = Female_Hormonal_NoContra_N,
         F_hormonal_m = Female_Hormonal_Contra_Mean,
         F_hormonal_sd = sqrt(Female_Hormonal_Contra_N)*Female_Hormonal_Contra_SE,
         F_hormonal_n = Female_Hormonal_Contra_N,
         sex = "female",
         type = "hormonal")

dat_f_horm <- escalc("ROM", 
                     m1i = F_hormonal_m,
                     m2i = F_control_m,
                     sd1i = F_hormonal_sd,
                     sd2i = F_control_sd,
                     n1i = F_hormonal_n,
                     n2i = F_control_n,
                     data = dat_f_horm,
)

# female surgical data

dat_f_surg<- dat %>% filter(is.na(Female_Surgical_Contra_Mean) == FALSE, is.na(Female_Hormonal_NoContra_Mean) == FALSE) %>% 
  mutate(F_control_m = Female_Surgical_NoContra_Mean,
         F_control_sd = sqrt(Female_Surgical_NoContra_N)*Female_Surgical_NoContra_SE,
         F_control_n = Female_Surgical_NoContra_N,
         F_surgical_m = Female_Surgical_Contra_Mean,
         F_surgical_sd = sqrt(Female_Surgical_Contra_N)*Female_Surgical_Contra_SE,
         F_surgical_n = Female_Surgical_Contra_N,
         sex = "female",
         type = "surgical")


dat_f_surg <- escalc("ROM", 
                     m1i = F_surgical_m,
                     m2i = F_control_m,
                     sd1i = F_surgical_sd,
                     sd2i = F_control_sd,
                     n1i = F_surgical_n,
                     n2i = F_control_n,
                     data = dat_f_surg,
)

rbind(
dat_m_horm[ , c(1, 27, 28, 35:38)], # 1
dat_m_surg[ ,c(1, 27, 28, 35:38)], # 2
dat_f_horm[ , c(1, 27, 28, 35:38)], # 3 
dat_f_surg[ ,c(1, 27, 28, 35:38)] # 4
) -> dat_all

# observation id
dat_all$obs_id <- factor(1:nrow(dat_all))

# sex type combined
dat_all %>% mutate(sex_type = paste(sex, type, sep = "_")) -> dat_all

#write_csv(dat_all, here("data", "zoo", "effect1.csv"))
Code
######################################
# data sets looking at sex differences
######################################

# female normal vs. male surgical (1)

dat_fm_ns <- dat %>% filter(is.na(Female_Surgical_NoContra_Mean) == FALSE, 
                            is.na(Male_Surgical_Contra_Mean) == FALSE) %>% 
  transmute(F_normal_m = Female_Surgical_NoContra_Mean,
         F_normal_sd = sqrt(Female_Surgical_NoContra_N)*Female_Surgical_NoContra_SE,
         F_normal_n = Female_Surgical_NoContra_N,
         M_surgical_m = Male_Surgical_Contra_Mean,
         M_surgical_sd = sqrt(Male_Surgical_Contra_N)*Male_Surgical_Contra_SE,
         M_surgical_n = Male_Surgical_Contra_N,
         species = species,
         phylogeny = phylogeny,
         category = "M normal/F surgical"
         )

dat_fm_ns <- escalc("ROM", 
              m2i = F_normal_m,
              m1i = M_surgical_m,
              sd2i = F_normal_sd,
              sd1i = M_surgical_sd,
              n2i = F_normal_n,
              n1i = M_surgical_n,
              data = dat_fm_ns,
              )


# female hormonal vs. male normal (2)

dat_fm_hn <- dat %>% filter(is.na(Female_Hormonal_Contra_Mean) == FALSE, 
                            is.na(Male_Hormonal_NoContra_Mean) == FALSE) %>% 
  transmute(F_hormonal_m = Female_Hormonal_Contra_Mean,
         F_hormonal_sd = sqrt(Female_Hormonal_Contra_N)*Female_Hormonal_Contra_SE,
         F_hormonal_n = Female_Hormonal_Contra_N,
         M_normal_m = Male_Hormonal_NoContra_Mean,
         M_normal_sd = sqrt(Male_Hormonal_NoContra_N)*Male_Hormonal_NoContra_SE,
         M_normal_n = Male_Hormonal_NoContra_N,
         species = species,
         phylogeny = phylogeny,
         category = "M hormonal/F normal"
         )

dat_fm_hn <- escalc("ROM", 
              m2i = F_hormonal_m,
              m1i = M_normal_m,
              sd2i = F_hormonal_sd,
              sd1i = M_normal_sd,
              n2i = F_hormonal_n,
              n1i = M_normal_m,
              data = dat_fm_hn,
              )



# female surgical vs. male normal (3)

dat_fm_sn <- dat %>% filter(is.na(Female_Surgical_Contra_Mean) == FALSE,
                            is.na(Male_Surgical_NoContra_Mean) == FALSE) %>%
  transmute(F_surgical_m = Female_Surgical_Contra_Mean,
         F_surgical_sd = sqrt(Female_Surgical_Contra_N)*Female_Surgical_Contra_SE,
         F_surgical_n = Female_Surgical_Contra_N,
         M_normal_m = Male_Surgical_NoContra_Mean,
         M_normal_sd = sqrt(Male_Surgical_NoContra_N)*Male_Surgical_NoContra_SE,
         M_normal_n = Male_Surgical_NoContra_N,
         species = species,
         phylogeny = phylogeny,
         category = "M hormonal/F normal"
         )

dat_fm_sn <- escalc("ROM", 
              m2i = F_surgical_m,
              m1i = M_normal_m,
              sd2i = F_surgical_sd,
              sd1i = M_normal_sd,
              n2i = F_surgical_n,
              n1i = M_normal_n,
              data = dat_fm_sn,
              )


# female surgical vs. male surgical (4)

dat_fm_ss <- dat %>% filter(is.na(Female_Surgical_Contra_Mean) == FALSE, 
                            is.na(Male_Surgical_Contra_Mean) == FALSE) %>% 
    transmute(F_surgical_m = Female_Surgical_Contra_Mean,
                 F_surgical_sd = sqrt(Female_Surgical_Contra_N)*Female_Surgical_Contra_SE,
                 F_surgical_n = Female_Surgical_Contra_N,
                 M_surgical_m = Male_Surgical_Contra_Mean,
                 M_surgical_sd = sqrt(Male_Surgical_Contra_N)*Male_Surgical_Contra_SE,
                 M_surgical_n = Male_Surgical_Contra_N,
                 species = species,
                 phylogeny = phylogeny,
                 category = "M surgical/F surgical"
                 )

dat_fm_ss <- escalc("ROM", 
                            m2i = F_surgical_m,
                            m1i = M_surgical_m,
                            sd2i = F_surgical_sd,
                            sd1i = M_surgical_sd,
                            n2i = F_surgical_n,
                            n1i = M_surgical_n,
                            data = dat_fm_ss,
                            )

# female normal vs. male normal (5)

dat_fm_nn1 <- dat %>% filter(is.na(Female_Hormonal_NoContra_Mean) == FALSE, 
                                                        is.na(Male_Hormonal_NoContra_Mean) == FALSE) %>% 
    transmute(F_normal_m = Female_Hormonal_NoContra_Mean,
                 F_normal_sd = sqrt(Female_Hormonal_NoContra_N)*Female_Hormonal_NoContra_SE,
                 F_normal_n = Female_Hormonal_NoContra_N,
                 M_normal_m = Male_Hormonal_NoContra_Mean,
                 M_normal_sd = sqrt(Male_Hormonal_NoContra_N)*Male_Hormonal_NoContra_SE,
                 M_normal_n = Male_Hormonal_NoContra_N,
                 species = species,
                 phylogeny = phylogeny,
                 category = "M normal/F normal"
                 )

dat_fm_nn1 <- escalc("ROM", 
                            m2i = F_normal_m,
                            m1i = M_normal_m,
                            sd2i = F_normal_sd,
                            sd1i = M_normal_sd,
                            n2i = F_normal_n,
                            n1i = M_normal_n,
                            data = dat_fm_nn1,
                            )

dat_fm_nn2 <- dat %>% filter(is.na(Female_Surgical_NoContra_Mean) == FALSE, 
                                                        is.na(Male_Surgical_NoContra_Mean) == FALSE) %>% 
    transmute(F_normal_m = Female_Surgical_NoContra_Mean,
                 F_normal_sd = sqrt(Female_Surgical_NoContra_N)*Female_Surgical_NoContra_SE,
                 F_normal_n = Female_Surgical_NoContra_N,
                 M_normal_m = Male_Surgical_NoContra_Mean,
                 M_normal_sd = sqrt(Male_Surgical_NoContra_N)*Male_Surgical_NoContra_SE,
                 M_normal_n = Male_Surgical_NoContra_N,
                 species = species,
                 phylogeny = phylogeny,
                 category = "M normal/F normal"
                 )

dat_fm_nn2 <- escalc("ROM", 
                            m2i = F_normal_m,
                            m1i = M_normal_m,
                            sd2i = F_normal_sd,
                            sd1i = M_normal_sd,
                            n2i = F_normal_n,
                            n1i = M_normal_n,
                            data = dat_fm_nn2,
                            )



# female normal vs. male hormonal (6)

dat_fm_nh <- dat %>% filter(is.na(Female_Hormonal_NoContra_Mean) == FALSE,
                            is.na(Male_Hormonal_Contra_Mean) == FALSE) %>%
  transmute(F_normal_m = Female_Hormonal_NoContra_Mean,
            F_normal_sd = sqrt(Female_Hormonal_NoContra_N)*Female_Hormonal_NoContra_SE,
            F_normal_n = Female_Hormonal_NoContra_N,
            M_hornomal_m = Male_Hormonal_Contra_Mean,
            M_hornomal_sd = sqrt(Male_Hormonal_Contra_N)*Male_Hormonal_Contra_SE,
            M_hornomal_n = Male_Hormonal_Contra_N,
            species = species,
            phylogeny = phylogeny,
            category = "M normal/F hornomal"
  )

dat_fm_nh <- escalc("ROM", 
                    m2i = F_normal_m,
                    m1i = M_hornomal_m,
                    sd2i = F_normal_sd,
                    sd1i = M_hornomal_sd,
                    n2i = F_normal_n,
                    n1i = M_hornomal_n,
                    data = dat_fm_nh,
)


# female hormonal vs. male hormonal (9)

dat_fm_hh <- dat %>% filter(is.na(Female_Hormonal_Contra_Mean) == FALSE,
                            is.na(Male_Hormonal_Contra_Mean) == FALSE) %>%
  transmute(F_hornomal_m = Female_Hormonal_Contra_Mean,
            F_hornomal_sd = sqrt(Female_Hormonal_Contra_N)*Female_Hormonal_Contra_SE,
            F_hornomal_n = Female_Hormonal_Contra_N,
            M_hornomal_m = Male_Hormonal_Contra_Mean,
            M_hornomal_sd = sqrt(Male_Hormonal_Contra_N)*Male_Hormonal_Contra_SE,
            M_hornomal_n = Male_Hormonal_Contra_N,
            species = species,
            phylogeny = phylogeny,
            category = "M hornomal/F hornomal"
  )
     
dat_fm_hh <- escalc("ROM", 
                    m2i = F_hornomal_m,
                    m1i = M_hornomal_m,
                    sd2i = F_hornomal_sd,
                    sd1i = M_hornomal_sd,
                    n2i = F_hornomal_n,
                    n1i = M_hornomal_n,
                    data = dat_fm_hh,
)



bind_rows(
  dat_fm_ns[ , 7:11], # 1
  dat_fm_hn[ , 7:11], # 2 
  dat_fm_sn[ , 7:11], # 3
  dat_fm_ss[ , 7:11], # 4
  dat_fm_nn1[ , 7:11], # 5
  dat_fm_nn2[ , 7:11], # 5
  dat_fm_nh[ , 7:11], # 6
  dat_fm_hh[ , 7:11], # 9
) -> dat_comb


dat_comb$obs_id <- factor(1:nrow(dat_comb))

# adding category
dat_comb$contraception <- factor(dat_comb$category, levels = c(
                                                           "M hornomal/F hornomal",
                                                           "M surgical/F surgical",
                                                           "M hormonal/F normal",  
                                                           "M surgical/F normal",
                                                           "M normal/F hormonal",
                                                           "M normal/F surgical",
                                                           "M normal/F normal"),
                                                labels = c(
                                                           "Male sterlized/\nFemale sterlized",
                                                           "Male sterlized/\nFemale sterlized",
                                                           "Male sterlized/\nFemale normal",
                                                           "Male sterlized/\nFemale normal",  
                                                           "Male normal/\nFemale sterlized",
                                                           "Male normal/\nFemale sterlized",
                                                           "Male normal/\nFemale normal"),
                             
)

# absolute values
dat_comb <- dat_comb %>% mutate(
  abs_yi2 = abs(yi), # conservative
  abs_yi = folded_mu(yi, vi), # alternative way
  abs_vi = folded_v(yi, vi))

#write_csv(dat_comb, here("data", "zoo", "effect2.csv"))

20 Datasets

Code
kable(dat, "html", escape = FALSE, digits = 3) %>% kable_styling("striped", position = "left", full_width = TRUE) %>% 
  scroll_box(width = "100%", 
    height = "500px")
species Female_Hormonal_Contra_N Female_Hormonal_Contra_Mean Female_Hormonal_Contra_SE Female_Hormonal_NoContra_N Female_Hormonal_NoContra_Mean Female_Hormonal_NoContra_SE Female_Surgical_Contra_N Female_Surgical_Contra_Mean Female_Surgical_Contra_SE Female_Surgical_NoContra_N Female_Surgical_NoContra_Mean Female_Surgical_NoContra_SE Male_Hormonal_Contra_N Male_Hormonal_Contra_Mean Male_Hormonal_Contra_SE Male_Hormonal_NoContra_N Male_Hormonal_NoContra_Mean Male_Hormonal_NoContra_SE Male_Surgical_Contra_N Male_Surgical_Contra_Mean Male_Surgical_Contra_SE Male_Surgical_NoContra_N Male_Surgical_NoContra_Mean Male_Surgical_NoContra_SE vertlifeSpecies order phylogeny
Addax nasomaculatus 37 9.404 0.885 935 8.661 0.189 NA NA NA NA NA NA NA NA NA NA NA NA 82 8.783 0.705 844 7.717 0.255 Addax nasomaculatus Artiodactyla Addax_nasomaculatus
Aepyceros melampus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 120 7.286 0.638 485 4.430 0.218 Aepyceros melampus Artiodactyla Aepyceros_melampus
Alouatta caraya 93 17.460 1.367 111 13.204 1.055 NA NA NA NA NA NA NA NA NA NA NA NA 38 14.720 1.599 227 13.845 0.660 Alouatta caraya Primates Alouatta_caraya
Ammotragus lervia NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 131 9.735 0.574 2019 10.299 0.197 Ammotragus lervia Artiodactyla Ammotragus_lervia
Antilope cervicapra NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 290 8.130 0.485 2336 4.937 0.115 Antilope cervicapra Artiodactyla Antilope_cervicapra
Aonyx cinerea 113 10.956 0.641 1307 9.375 0.190 NA NA NA NA NA NA 42 7.857 0.771 545 6.884 0.201 93 10.099 0.678 1355 10.022 0.209 Aonyx cinerea Carnivora Aonyx_cinerea
Atelerix albiventris NA NA NA NA NA NA 30 2.480 0.304 984 3.017 0.065 NA NA NA NA NA NA NA NA NA NA NA NA Atelerix albiventris Eulipotyphla Atelerix_albiventris
Ateles geoffroyi NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 36 19.667 3.370 157 25.520 2.487 Ateles geoffroyi Primates Ateles_geoffroyi
Axis axis 37 5.867 0.968 634 9.842 0.907 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Axis axis Artiodactyla Axis_axis
Bison bison NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 83 12.235 0.953 624 10.625 0.406 Bison bison Artiodactyla Bison_bison
Bos grunniens NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 32 8.477 1.353 325 10.341 0.493 Bos grunniens Artiodactyla Bos_grunniens
Boselaphus tragocamelus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 59 6.968 1.181 563 7.684 0.457 Boselaphus tragocamelus Artiodactyla Boselaphus_tragocamelus
Callimico goeldii 54 9.590 1.030 498 8.471 0.298 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Callimico goeldii Primates Callimico_goeldii
Callithrix geoffroyi 70 5.920 0.638 537 6.464 0.250 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Callithrix geoffroyi Primates Callithrix_geoffroyi
Callithrix jacchus 126 7.104 0.628 1458 6.688 0.175 NA NA NA NA NA NA NA NA NA NA NA NA 125 9.068 0.821 1702 7.248 0.177 Callithrix jacchus Primates Callithrix_jacchus
Camelus bactrianus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 80 12.456 1.013 587 13.328 0.380 Camelus bactrianus Artiodactyla Camelus_bactrianus
Camelus dromedarius NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 72 13.010 1.334 443 15.676 0.576 Camelus dromedarius Artiodactyla Camelus_dromedarius
Canis latrans NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 51 11.551 0.617 150 10.160 0.447 Canis latrans Carnivora Canis_latrans
Canis lupus NA NA NA NA NA NA 92 8.770 0.499 405 8.026 0.244 NA NA NA NA NA NA NA NA NA NA NA NA Canis lupus Carnivora Canis_lupus
Capra hircus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 503 8.020 0.219 1858 8.250 0.132 Capra hircus Artiodactyla Capra_hircus
Cavia porcellus NA NA NA NA NA NA 42 3.072 0.276 3222 3.841 0.045 NA NA NA NA NA NA 144 3.848 0.211 1379 3.713 0.070 Cavia porcellus Rodentia Cavia_porcellus
Cebuella pygmaea 47 6.839 0.887 961 5.652 0.158 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Cebuella pygmaea Primates Cebuella_pygmaea
Cebus capucinus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 43 27.580 2.778 131 19.896 1.558 Cebus capucinus Primates Cebus_capucinus
Cercopithecus neglectus 57 16.193 1.434 193 16.006 0.801 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Cercopithecus neglectus Primates Cercopithecus_neglectus
Cervus elaphus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 40 8.131 1.147 491 7.331 0.416 Cervus elaphus Artiodactyla Cervus_elaphus
Chinchilla lanigera NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 33 8.291 1.314 581 7.222 0.299 Chinchilla lanigera Rodentia Chinchilla_lanigera
Colobus guereza 101 17.032 1.278 290 11.754 0.636 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Colobus guereza Primates Colobus_guereza
Cynomys ludovicianus NA NA NA NA NA NA 45 5.258 0.717 1277 5.169 0.141 NA NA NA NA NA NA 116 4.916 0.431 1108 5.333 0.174 Cynomys ludovicianus Rodentia Cynomys_ludovicianus
Dama dama NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 142 9.422 0.981 1922 6.780 0.203 Dama dama Artiodactyla Dama_dama
Desmodus rotundus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 69 14.310 1.600 464 11.066 0.505 Desmodus rotundus Chiroptera Desmodus_rotundus
Didelphis virginiana NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 54 1.712 0.124 389 1.564 0.054 Didelphis virginiana Didelphimorphia Didelphis_virginiana
Dolichotis patagonum NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 107 5.813 0.573 1744 5.303 0.135 Dolichotis patagonum Rodentia Dolichotis_patagonum
Eidolon helvum NA NA NA NA NA NA 92 19.701 1.012 548 16.746 0.436 NA NA NA NA NA NA 164 15.747 0.756 493 14.047 0.415 Eidolon helvum Chiroptera Eidolon_helvum
Equus caballus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 89 18.452 1.440 543 19.652 0.756 Equus caballus Perissodactyla Equus_caballus
Equus quagga NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 50 21.485 2.425 235 13.169 0.890 Equus quagga Perissodactyla Equus_quagga
Erythrocebus patas 44 13.913 1.353 305 11.944 0.508 NA NA NA NA NA NA NA NA NA NA NA NA 36 10.223 1.412 233 10.912 0.651 Erythrocebus patas Primates Erythrocebus_patas
Eudorcas thomsonii NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 56 7.969 0.849 358 5.150 0.286 Eudorcas thomsonii Artiodactyla Eudorcas_thomsonii
Eulemur macaco 44 15.286 2.019 131 11.052 0.831 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Eulemur macaco Primates Eulemur_macaco
Felis catus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 76 12.748 1.414 476 12.373 0.691 Felis catus Carnivora Felis_catus
Giraffa camelopardalis 48 16.456 1.622 362 11.278 0.437 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Giraffa camelopardalis Artiodactyla Giraffa_camelopardalis
Hemitragus jemlahicus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 36 7.154 0.987 298 7.437 0.409 Hemitragus jemlahicus Artiodactyla Hemitragus_jemlahicus
Hydrochoerus hydrochaeris 41 5.711 0.597 1867 6.094 0.108 NA NA NA NA NA NA NA NA NA NA NA NA 121 5.491 0.382 1513 5.593 0.123 Hydrochoerus hydrochaeris Rodentia Hydrochoerus_hydrochaeris
Kobus megaceros NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 70 7.206 0.764 332 6.259 0.328 Kobus megaceros Artiodactyla Kobus_megaceros
Lama glama NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 219 13.010 0.782 1320 14.044 0.374 Lama glama Artiodactyla Lama_glama
Lama guanicoe NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 52 11.687 1.608 346 11.654 0.643 Lama guanicoe Artiodactyla Lama_guanicoe
Lemur catta 485 16.442 0.682 3377 14.746 0.225 61 14.881 1.478 3810 15.029 0.220 NA NA NA NA NA NA 429 17.304 0.826 3789 15.697 0.228 Lemur catta Primates Lemur_catta
Leontopithecus chrysomelas 87 10.635 0.775 346 8.604 0.354 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Leontopithecus chrysomelas Primates Leontopithecus_chrysomelas
Leontopithecus rosalia 164 10.250 0.535 280 8.353 0.379 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Leontopithecus rosalia Primates Leontopithecus_rosalia
Leptailurus serval 39 11.373 1.386 516 12.374 0.417 38 14.381 1.441 516 12.352 0.423 NA NA NA NA NA NA 62 13.596 0.772 439 11.363 0.348 Leptailurus serval Carnivora Leptailurus_serval
Lycaon pictus 79 7.472 0.541 328 7.031 0.242 74 8.274 0.540 328 7.078 0.241 30 5.053 0.512 312 5.141 0.152 NA NA NA NA NA NA Lycaon pictus Carnivora Lycaon_pictus
Lynx lynx NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 23 8.151 0.815 154 7.514 0.367 Lynx lynx Carnivora Lynx_lynx
Lynx rufus NA NA NA NA NA NA 44 12.164 0.843 188 12.299 0.453 NA NA NA NA NA NA 76 16.504 0.774 233 14.127 0.540 Lynx rufus Carnivora Lynx_rufus
Macaca fascicularis NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 71 13.550 2.437 362 11.692 0.859 Macaca fascicularis Primates Macaca_fascicularis
Macaca fuscata 82 16.090 1.045 398 17.007 0.586 NA NA NA NA NA NA NA NA NA NA NA NA 95 15.961 1.389 261 14.113 0.801 Macaca fuscata Primates Macaca_fuscata
Macaca leonina NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 46 11.400 2.742 60 14.702 2.922 Macaca leonina Primates Macaca_leonina
Macaca mulatta NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 119 21.963 1.852 340 16.382 0.903 Macaca mulatta Primates Macaca_mulatta
Macaca nemestrina 30 12.476 2.058 177 13.511 0.928 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Macaca nemestrina Primates Macaca_nemestrina
Macaca nigra 73 13.287 1.207 158 13.483 0.832 NA NA NA NA NA NA NA NA NA NA NA NA 58 8.971 1.120 150 10.869 0.744 Macaca nigra Primates Macaca_nigra
Macaca silenus 80 17.397 1.688 305 16.555 0.740 NA NA NA NA NA NA 37 13.802 2.074 273 13.029 0.676 46 13.358 1.534 263 12.543 0.688 Macaca silenus Primates Macaca_silenus
Macaca sylvanus 237 15.123 0.834 494 12.926 0.517 NA NA NA NA NA NA NA NA NA NA NA NA 235 16.668 1.254 389 11.496 0.577 Macaca sylvanus Primates Macaca_sylvanus
Macropus fuliginosus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 89 7.698 0.781 389 6.289 0.350 Macropus fuliginosus Diprotodontia Macropus_fuliginosus
Macropus giganteus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 91 7.935 0.605 425 6.567 0.307 Macropus giganteus Diprotodontia Macropus_giganteus
Mandrillus sphinx 207 18.095 0.850 375 15.310 0.619 NA NA NA NA NA NA 38 12.095 1.616 370 12.523 0.570 81 13.610 1.090 393 13.195 0.556 Mandrillus sphinx Primates Mandrillus_sphinx
Mephitis mephitis NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 113 4.896 0.232 375 5.097 0.135 Mephitis mephitis Carnivora Mephitis_mephitis
Mungos mungo NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 48 8.018 1.048 710 9.392 0.279 Mungos mungo Carnivora Mungos_mungo
Muntiacus reevesi NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 64 7.482 0.783 299 5.918 0.276 Muntiacus reevesi Artiodactyla Muntiacus_reevesi
Mustela nigripes NA NA NA NA NA NA 40 2.243 0.171 203 2.190 0.093 NA NA NA NA NA NA 52 2.664 0.170 423 2.613 0.077 Mustela nigripes Carnivora Mustela_nigripes
Myocastor coypus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 38 2.822 0.460 221 2.896 0.203 Myocastor coypus Rodentia Myocastor_coypus
Nasua narica NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 34 7.485 0.699 122 8.583 0.472 Nasua narica Carnivora Nasua_narica
Nasua nasua 39 6.998 0.672 1056 7.133 0.138 41 9.468 0.867 1428 9.820 0.153 NA NA NA NA NA NA 224 9.565 0.384 928 8.381 0.186 Nasua nasua Carnivora Nasua_nasua
Nomascus leucogenys 50 25.102 2.628 66 25.019 2.242 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Nomascus leucogenys Primates Nomascus_leucogenys
Notamacropus parma NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 43 6.032 0.712 748 4.664 0.156 Macropus parma Diprotodontia Macropus_parma
Notamacropus rufogriseus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 620 6.392 0.256 2869 5.433 0.106 Macropus rufogriseus Diprotodontia Macropus_rufogriseus
Octodon degus 83 5.591 0.439 502 4.202 0.148 NA NA NA NA NA NA NA NA NA NA NA NA 175 4.120 0.250 363 3.643 0.148 Octodon degus Rodentia Octodon_degus
Odocoileus virginianus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 39 11.605 1.666 270 8.005 0.531 Odocoileus virginianus Artiodactyla Odocoileus_virginianus
Oryctolagus cuniculus NA NA NA NA NA NA 42 5.759 0.643 493 4.624 0.180 NA NA NA NA NA NA 87 5.062 0.420 312 5.153 0.227 Oryctolagus cuniculus Lagomorpha Oryctolagus_cuniculus
Oryx dammah 36 11.274 1.139 2407 10.693 0.141 NA NA NA NA NA NA NA NA NA NA NA NA 172 11.413 0.660 1818 8.982 0.210 Oryx dammah Artiodactyla Oryx_dammah
Osphranter rufus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 221 6.925 0.341 1959 5.703 0.120 Macropus rufus Diprotodontia Macropus_rufus
Ovis aries NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 58 7.569 0.763 558 7.842 0.295 Ovis aries Artiodactyla Ovis_aries
Pan troglodytes 359 32.835 1.385 659 32.157 0.921 49 32.245 2.623 603 28.307 0.915 NA NA NA NA NA NA 226 30.202 1.952 430 22.393 0.919 Pan troglodytes Primates Pan_troglodytes
Panthera leo 289 13.217 0.413 1307 11.722 0.192 152 12.486 0.455 1307 11.680 0.194 NA NA NA NA NA NA 177 13.062 0.474 1311 13.440 0.221 Panthera leo Carnivora Panthera_leo
Panthera onca 35 14.605 0.960 374 14.756 0.364 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Panthera onca Carnivora Panthera_onca
Panthera tigris NA NA NA NA NA NA 43 12.221 0.764 551 10.931 0.271 NA NA NA NA NA NA NA NA NA NA NA NA Panthera tigris Carnivora Panthera_tigris
Papio hamadryas 370 17.620 0.605 979 13.618 0.353 134 15.495 0.865 828 12.275 0.351 NA NA NA NA NA NA 179 14.001 0.864 945 11.762 0.332 Papio hamadryas Primates Papio_hamadryas
Papio papio 41 15.151 1.591 188 15.154 0.777 NA NA NA NA NA NA NA NA NA NA NA NA 49 13.524 1.884 133 14.236 0.851 Papio papio Primates Papio_papio
Pecari tajacu NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 77 12.985 1.043 322 11.849 0.499 Pecari tajacu Artiodactyla Pecari_tajacu
Petaurus breviceps NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 105 6.668 0.514 848 7.070 0.211 Petaurus breviceps Diprotodontia Petaurus_breviceps
Phacochoerus africanus 51 9.591 0.676 230 9.199 0.342 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Phacochoerus africanus Artiodactyla Phacochoerus_africanus
Pithecia pithecia 98 14.737 1.545 183 12.017 0.927 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Pithecia pithecia Primates Pithecia_pithecia
Pongo abelii 84 34.009 2.407 245 27.654 1.399 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Pongo abelii Primates Pongo_abelii
Potamochoerus porcus 49 9.872 0.765 321 10.322 0.328 NA NA NA NA NA NA NA NA NA NA NA NA 37 12.158 0.940 305 10.221 0.334 Potamochoerus porcus Artiodactyla Potamochoerus_porcus
Procavia capensis NA NA NA NA NA NA NA NA NA NA NA NA 62 4.941 0.524 372 4.343 0.196 NA NA NA NA NA NA Procavia capensis Hyracoidea Procavia_capensis
Procyon lotor NA NA NA NA NA NA 180 11.019 0.571 1111 10.486 0.223 NA NA NA NA NA NA 392 11.439 0.432 998 8.962 0.245 Procyon lotor Carnivora Procyon_lotor
Pteropus rodricensis 131 12.309 1.035 845 10.060 0.331 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Pteropus rodricensis Chiroptera Pteropus_rodricensis
Puma concolor NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 60 9.157 0.502 315 9.149 0.254 Puma concolor Carnivora Puma_concolor
Rangifer tarandus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 48 7.381 0.880 649 5.310 0.214 Rangifer tarandus Artiodactyla Rangifer_tarandus
Rattus norvegicus NA NA NA NA NA NA 34 1.480 0.189 647 1.292 0.036 NA NA NA NA NA NA 42 1.275 0.120 355 1.248 0.045 Rattus norvegicus Rodentia Rattus_norvegicus
Rousettus aegyptiacus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 76 7.384 0.648 985 9.052 0.250 Rousettus aegyptiacus Chiroptera Rousettus_aegyptiacus
Saguinus bicolor 64 9.738 1.079 81 7.510 0.739 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Saguinus bicolor Primates Saguinus_bicolor
Saguinus oedipus 216 10.693 0.627 1254 9.136 0.224 33 8.245 1.198 1254 9.130 0.235 37 9.276 1.212 1257 9.494 0.194 96 10.797 0.871 1540 10.260 0.202 Saguinus oedipus Primates Saguinus_oedipus
Saimiri sciureus 74 14.236 1.414 1726 11.625 0.252 NA NA NA NA NA NA NA NA NA NA NA NA 114 14.186 1.309 1402 9.195 0.254 Saimiri sciureus Primates Saimiri_sciureus
Sapajus apella NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 89 18.216 1.890 793 20.521 0.768 Sapajus apella Primates Sapajus_apella
Suricata suricatta 263 8.367 0.310 4132 7.623 0.086 67 6.654 0.492 2956 6.527 0.085 69 8.880 0.661 4952 8.183 0.078 270 8.428 0.328 4952 8.183 0.076 Suricata suricatta Carnivora Suricata_suricatta
Sus scrofa NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 30 8.267 1.021 269 8.448 0.385 Sus scrofa Artiodactyla Sus_scrofa
Symphalangus syndactylus 92 25.344 2.629 158 20.423 1.502 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Symphalangus syndactylus Primates Symphalangus_syndactylus
Trachypithecus cristatus 39 16.334 2.061 61 13.114 1.417 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Trachypithecus cristatus Primates Trachypithecus_cristatus
Trachypithecus francoisi 59 12.951 1.381 55 12.155 1.372 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Trachypithecus francoisi Primates Trachypithecus_francoisi
Tragelaphus oryx NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 159 9.504 0.661 1084 7.019 0.217 Tragelaphus oryx Artiodactyla Tragelaphus_oryx
Tragelaphus strepsiceros 35 6.728 0.743 649 6.715 0.190 NA NA NA NA NA NA NA NA NA NA NA NA 43 5.565 0.658 476 4.753 0.184 Tragelaphus strepsiceros Artiodactyla Tragelaphus_strepsiceros
Ursus americanus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 71 19.686 1.339 235 18.107 0.722 Ursus americanus Carnivora Ursus_americanus
Ursus arctos NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 61 21.773 1.742 206 23.531 0.967 Ursus arctos Carnivora Ursus_arctos
Varecia rubra 160 17.404 1.025 397 16.249 0.569 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA Varecia rubra Primates Varecia_rubra
Vicugna pacos NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 139 11.875 0.621 820 12.234 0.291 Vicugna pacos Artiodactyla Vicugna_pacos
Vulpes lagopus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 31 6.193 0.705 206 6.074 0.285 Vulpes lagopus Carnivora Vulpes_lagopus
Vulpes vulpes NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 64 12.126 1.113 466 9.264 0.296 Vulpes vulpes Carnivora Vulpes_vulpes
Vulpes zerda NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 40 6.240 0.519 478 7.368 0.178 Vulpes zerda Carnivora Vulpes_zerda
Zalophus californianus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 36 10.913 1.145 296 12.483 0.506 Zalophus californianus Carnivora Zalophus_californianus
Code
kable(dat_all, "html", escape = FALSE, digits = 3) %>% kable_styling("striped", position = "left", full_width = TRUE) %>% 
  scroll_box(width = "100%", 
    height = "500px")
species order phylogeny sex type yi vi obs_id sex_type
Aonyx cinerea Carnivora Aonyx_cinerea male hormonal 0.132 0.526 1 male_hormonal
Lycaon pictus Carnivora Lycaon_pictus male hormonal -0.017 0.603 2 male_hormonal
Macaca silenus Primates Macaca_silenus male hormonal 0.058 0.405 3 male_hormonal
Mandrillus sphinx Primates Mandrillus_sphinx male hormonal -0.035 0.422 4 male_hormonal
Procavia capensis Hyracoidea Procavia_capensis male hormonal 0.129 1.334 5 male_hormonal
Saguinus oedipus Primates Saguinus_oedipus male hormonal -0.023 0.521 6 male_hormonal
Suricata suricatta Carnivora Suricata_suricatta male hormonal 0.082 0.579 7 male_hormonal
Addax nasomaculatus Artiodactyla Addax_nasomaculatus male surgical 0.129 0.008 8 male_surgical
Aepyceros melampus Artiodactyla Aepyceros_melampus male surgical 0.498 0.010 9 male_surgical
Alouatta caraya Primates Alouatta_caraya male surgical 0.061 0.014 10 male_surgical
Ammotragus lervia Artiodactyla Ammotragus_lervia male surgical -0.056 0.004 11 male_surgical
Antilope cervicapra Artiodactyla Antilope_cervicapra male surgical 0.499 0.004 12 male_surgical
Aonyx cinerea Carnivora Aonyx_cinerea male surgical 0.008 0.005 13 male_surgical
Ateles geoffroyi Primates Ateles_geoffroyi male surgical -0.261 0.039 14 male_surgical
Bison bison Artiodactyla Bison_bison male surgical 0.141 0.008 15 male_surgical
Bos grunniens Artiodactyla Bos_grunniens male surgical -0.199 0.028 16 male_surgical
Boselaphus tragocamelus Artiodactyla Boselaphus_tragocamelus male surgical -0.098 0.032 17 male_surgical
Callithrix jacchus Primates Callithrix_jacchus male surgical 0.224 0.009 18 male_surgical
Camelus bactrianus Artiodactyla Camelus_bactrianus male surgical -0.068 0.007 19 male_surgical
Camelus dromedarius Artiodactyla Camelus_dromedarius male surgical -0.186 0.012 20 male_surgical
Canis latrans Carnivora Canis_latrans male surgical 0.128 0.005 21 male_surgical
Capra hircus Artiodactyla Capra_hircus male surgical -0.028 0.001 22 male_surgical
Cavia porcellus Rodentia Cavia_porcellus male surgical 0.036 0.003 23 male_surgical
Cebus capucinus Primates Cebus_capucinus male surgical 0.327 0.016 24 male_surgical
Cervus elaphus Artiodactyla Cervus_elaphus male surgical 0.104 0.023 25 male_surgical
Chinchilla lanigera Rodentia Chinchilla_lanigera male surgical 0.138 0.027 26 male_surgical
Cynomys ludovicianus Rodentia Cynomys_ludovicianus male surgical -0.081 0.009 27 male_surgical
Dama dama Artiodactyla Dama_dama male surgical 0.329 0.012 28 male_surgical
Desmodus rotundus Chiroptera Desmodus_rotundus male surgical 0.257 0.015 29 male_surgical
Didelphis virginiana Didelphimorphia Didelphis_virginiana male surgical 0.090 0.006 30 male_surgical
Dolichotis patagonum Rodentia Dolichotis_patagonum male surgical 0.092 0.010 31 male_surgical
Eidolon helvum Chiroptera Eidolon_helvum male surgical 0.114 0.003 32 male_surgical
Equus caballus Perissodactyla Equus_caballus male surgical -0.063 0.008 33 male_surgical
Equus quagga Perissodactyla Equus_quagga male surgical 0.489 0.017 34 male_surgical
Erythrocebus patas Primates Erythrocebus_patas male surgical -0.065 0.023 35 male_surgical
Eudorcas thomsonii Artiodactyla Eudorcas_thomsonii male surgical 0.437 0.014 36 male_surgical
Felis catus Carnivora Felis_catus male surgical 0.030 0.015 37 male_surgical
Hemitragus jemlahicus Artiodactyla Hemitragus_jemlahicus male surgical -0.039 0.022 38 male_surgical
Hydrochoerus hydrochaeris Rodentia Hydrochoerus_hydrochaeris male surgical -0.018 0.005 39 male_surgical
Kobus megaceros Artiodactyla Kobus_megaceros male surgical 0.141 0.014 40 male_surgical
Lama glama Artiodactyla Lama_glama male surgical -0.077 0.004 41 male_surgical
Lama guanicoe Artiodactyla Lama_guanicoe male surgical 0.003 0.022 42 male_surgical
Lemur catta Primates Lemur_catta male surgical 0.097 0.002 43 male_surgical
Leptailurus serval Carnivora Leptailurus_serval male surgical 0.179 0.004 44 male_surgical
Lynx lynx Carnivora Lynx_lynx male surgical 0.081 0.012 45 male_surgical
Lynx rufus Carnivora Lynx_rufus male surgical 0.156 0.004 46 male_surgical
Macaca fascicularis Primates Macaca_fascicularis male surgical 0.147 0.038 47 male_surgical
Macaca fuscata Primates Macaca_fuscata male surgical 0.123 0.011 48 male_surgical
Macaca leonina Primates Macaca_leonina male surgical -0.254 0.097 49 male_surgical
Macaca mulatta Primates Macaca_mulatta male surgical 0.293 0.010 50 male_surgical
Macaca nigra Primates Macaca_nigra male surgical -0.192 0.020 51 male_surgical
Macaca silenus Primates Macaca_silenus male surgical 0.063 0.016 52 male_surgical
Macaca sylvanus Primates Macaca_sylvanus male surgical 0.371 0.008 53 male_surgical
Macropus fuliginosus Diprotodontia Macropus_fuliginosus male surgical 0.202 0.013 54 male_surgical
Macropus giganteus Diprotodontia Macropus_giganteus male surgical 0.189 0.008 55 male_surgical
Mandrillus sphinx Primates Mandrillus_sphinx male surgical 0.031 0.008 56 male_surgical
Mephitis mephitis Carnivora Mephitis_mephitis male surgical -0.040 0.003 57 male_surgical
Mungos mungo Carnivora Mungos_mungo male surgical -0.158 0.018 58 male_surgical
Muntiacus reevesi Artiodactyla Muntiacus_reevesi male surgical 0.235 0.013 59 male_surgical
Mustela nigripes Carnivora Mustela_nigripes male surgical 0.019 0.005 60 male_surgical
Myocastor coypus Rodentia Myocastor_coypus male surgical -0.026 0.031 61 male_surgical
Nasua narica Carnivora Nasua_narica male surgical -0.137 0.012 62 male_surgical
Nasua nasua Carnivora Nasua_nasua male surgical 0.132 0.002 63 male_surgical
Notamacropus parma Diprotodontia Macropus_parma male surgical 0.257 0.015 64 male_surgical
Notamacropus rufogriseus Diprotodontia Macropus_rufogriseus male surgical 0.163 0.002 65 male_surgical
Octodon degus Rodentia Octodon_degus male surgical 0.123 0.005 66 male_surgical
Odocoileus virginianus Artiodactyla Odocoileus_virginianus male surgical 0.371 0.025 67 male_surgical
Oryctolagus cuniculus Lagomorpha Oryctolagus_cuniculus male surgical -0.018 0.009 68 male_surgical
Oryx dammah Artiodactyla Oryx_dammah male surgical 0.240 0.004 69 male_surgical
Osphranter rufus Diprotodontia Macropus_rufus male surgical 0.194 0.003 70 male_surgical
Ovis aries Artiodactyla Ovis_aries male surgical -0.035 0.012 71 male_surgical
Pan troglodytes Primates Pan_troglodytes male surgical 0.299 0.006 72 male_surgical
Panthera leo Carnivora Panthera_leo male surgical -0.028 0.002 73 male_surgical
Papio hamadryas Primates Papio_hamadryas male surgical 0.174 0.005 74 male_surgical
Papio papio Primates Papio_papio male surgical -0.051 0.023 75 male_surgical
Pecari tajacu Artiodactyla Pecari_tajacu male surgical 0.091 0.008 76 male_surgical
Petaurus breviceps Diprotodontia Petaurus_breviceps male surgical -0.059 0.007 77 male_surgical
Potamochoerus porcus Artiodactyla Potamochoerus_porcus male surgical 0.174 0.007 78 male_surgical
Procyon lotor Carnivora Procyon_lotor male surgical 0.244 0.002 79 male_surgical
Puma concolor Carnivora Puma_concolor male surgical 0.001 0.004 80 male_surgical
Rangifer tarandus Artiodactyla Rangifer_tarandus male surgical 0.329 0.016 81 male_surgical
Rattus norvegicus Rodentia Rattus_norvegicus male surgical 0.021 0.010 82 male_surgical
Rousettus aegyptiacus Chiroptera Rousettus_aegyptiacus male surgical -0.204 0.008 83 male_surgical
Saguinus oedipus Primates Saguinus_oedipus male surgical 0.051 0.007 84 male_surgical
Saimiri sciureus Primates Saimiri_sciureus male surgical 0.434 0.009 85 male_surgical
Sapajus apella Primates Sapajus_apella male surgical -0.119 0.012 86 male_surgical
Suricata suricatta Carnivora Suricata_suricatta male surgical 0.030 0.002 87 male_surgical
Sus scrofa Artiodactyla Sus_scrofa male surgical -0.022 0.017 88 male_surgical
Tragelaphus oryx Artiodactyla Tragelaphus_oryx male surgical 0.303 0.006 89 male_surgical
Tragelaphus strepsiceros Artiodactyla Tragelaphus_strepsiceros male surgical 0.158 0.015 90 male_surgical
Ursus americanus Carnivora Ursus_americanus male surgical 0.084 0.006 91 male_surgical
Ursus arctos Carnivora Ursus_arctos male surgical -0.078 0.008 92 male_surgical
Vicugna pacos Artiodactyla Vicugna_pacos male surgical -0.030 0.003 93 male_surgical
Vulpes lagopus Carnivora Vulpes_lagopus male surgical 0.019 0.015 94 male_surgical
Vulpes vulpes Carnivora Vulpes_vulpes male surgical 0.269 0.009 95 male_surgical
Vulpes zerda Carnivora Vulpes_zerda male surgical -0.166 0.008 96 male_surgical
Zalophus californianus Carnivora Zalophus_californianus male surgical -0.134 0.013 97 male_surgical
Addax nasomaculatus Artiodactyla Addax_nasomaculatus female hormonal 0.082 0.009 98 female_hormonal
Alouatta caraya Primates Alouatta_caraya female hormonal 0.279 0.013 99 female_hormonal
Aonyx cinerea Carnivora Aonyx_cinerea female hormonal 0.156 0.004 100 female_hormonal
Axis axis Artiodactyla Axis_axis female hormonal -0.517 0.036 101 female_hormonal
Callimico goeldii Primates Callimico_goeldii female hormonal 0.124 0.013 102 female_hormonal
Callithrix geoffroyi Primates Callithrix_geoffroyi female hormonal -0.088 0.013 103 female_hormonal
Callithrix jacchus Primates Callithrix_jacchus female hormonal 0.060 0.009 104 female_hormonal
Cebuella pygmaea Primates Cebuella_pygmaea female hormonal 0.191 0.018 105 female_hormonal
Cercopithecus neglectus Primates Cercopithecus_neglectus female hormonal 0.012 0.010 106 female_hormonal
Colobus guereza Primates Colobus_guereza female hormonal 0.371 0.009 107 female_hormonal
Erythrocebus patas Primates Erythrocebus_patas female hormonal 0.153 0.011 108 female_hormonal
Eulemur macaco Primates Eulemur_macaco female hormonal 0.324 0.023 109 female_hormonal
Giraffa camelopardalis Artiodactyla Giraffa_camelopardalis female hormonal 0.378 0.011 110 female_hormonal
Hydrochoerus hydrochaeris Rodentia Hydrochoerus_hydrochaeris female hormonal -0.065 0.011 111 female_hormonal
Lemur catta Primates Lemur_catta female hormonal 0.109 0.002 112 female_hormonal
Leontopithecus chrysomelas Primates Leontopithecus_chrysomelas female hormonal 0.212 0.007 113 female_hormonal
Leontopithecus rosalia Primates Leontopithecus_rosalia female hormonal 0.205 0.005 114 female_hormonal
Leptailurus serval Carnivora Leptailurus_serval female hormonal -0.084 0.016 115 female_hormonal
Lycaon pictus Carnivora Lycaon_pictus female hormonal 0.061 0.006 116 female_hormonal
Macaca fuscata Primates Macaca_fuscata female hormonal -0.055 0.005 117 female_hormonal
Macaca nemestrina Primates Macaca_nemestrina female hormonal -0.080 0.032 118 female_hormonal
Macaca nigra Primates Macaca_nigra female hormonal -0.015 0.012 119 female_hormonal
Macaca silenus Primates Macaca_silenus female hormonal 0.050 0.011 120 female_hormonal
Macaca sylvanus Primates Macaca_sylvanus female hormonal 0.157 0.005 121 female_hormonal
Mandrillus sphinx Primates Mandrillus_sphinx female hormonal 0.167 0.004 122 female_hormonal
Nasua nasua Carnivora Nasua_nasua female hormonal -0.019 0.010 123 female_hormonal
Nomascus leucogenys Primates Nomascus_leucogenys female hormonal 0.003 0.019 124 female_hormonal
Octodon degus Rodentia Octodon_degus female hormonal 0.286 0.007 125 female_hormonal
Oryx dammah Artiodactyla Oryx_dammah female hormonal 0.053 0.010 126 female_hormonal
Pan troglodytes Primates Pan_troglodytes female hormonal 0.021 0.003 127 female_hormonal
Panthera leo Carnivora Panthera_leo female hormonal 0.120 0.001 128 female_hormonal
Panthera onca Carnivora Panthera_onca female hormonal -0.010 0.005 129 female_hormonal
Papio hamadryas Primates Papio_hamadryas female hormonal 0.258 0.002 130 female_hormonal
Papio papio Primates Papio_papio female hormonal 0.000 0.014 131 female_hormonal
Phacochoerus africanus Artiodactyla Phacochoerus_africanus female hormonal 0.042 0.006 132 female_hormonal
Pithecia pithecia Primates Pithecia_pithecia female hormonal 0.204 0.017 133 female_hormonal
Pongo abelii Primates Pongo_abelii female hormonal 0.207 0.008 134 female_hormonal
Potamochoerus porcus Artiodactyla Potamochoerus_porcus female hormonal -0.045 0.007 135 female_hormonal
Pteropus rodricensis Chiroptera Pteropus_rodricensis female hormonal 0.202 0.008 136 female_hormonal
Saguinus bicolor Primates Saguinus_bicolor female hormonal 0.260 0.022 137 female_hormonal
Saguinus oedipus Primates Saguinus_oedipus female hormonal 0.157 0.004 138 female_hormonal
Saimiri sciureus Primates Saimiri_sciureus female hormonal 0.203 0.010 139 female_hormonal
Suricata suricatta Carnivora Suricata_suricatta female hormonal 0.093 0.001 140 female_hormonal
Symphalangus syndactylus Primates Symphalangus_syndactylus female hormonal 0.216 0.016 141 female_hormonal
Trachypithecus cristatus Primates Trachypithecus_cristatus female hormonal 0.220 0.028 142 female_hormonal
Trachypithecus francoisi Primates Trachypithecus_francoisi female hormonal 0.063 0.024 143 female_hormonal
Tragelaphus strepsiceros Artiodactyla Tragelaphus_strepsiceros female hormonal 0.002 0.013 144 female_hormonal
Varecia rubra Primates Varecia_rubra female hormonal 0.069 0.005 145 female_hormonal
Lemur catta Primates Lemur_catta female surgical -0.010 0.010 146 female_surgical
Leptailurus serval Carnivora Leptailurus_serval female surgical 0.152 0.011 147 female_surgical
Lycaon pictus Carnivora Lycaon_pictus female surgical 0.156 0.005 148 female_surgical
Nasua nasua Carnivora Nasua_nasua female surgical -0.037 0.009 149 female_surgical
Pan troglodytes Primates Pan_troglodytes female surgical 0.130 0.008 150 female_surgical
Panthera leo Carnivora Panthera_leo female surgical 0.067 0.002 151 female_surgical
Papio hamadryas Primates Papio_hamadryas female surgical 0.233 0.004 152 female_surgical
Saguinus oedipus Primates Saguinus_oedipus female surgical -0.102 0.022 153 female_surgical
Suricata suricatta Carnivora Suricata_suricatta female surgical 0.019 0.006 154 female_surgical
Code
kable(dat_comb, "html", escape = FALSE, digits = 3) %>% kable_styling("striped", position = "left", full_width = TRUE) %>% 
  scroll_box(width = "100%", 
    height = "500px")
species phylogeny category yi vi obs_id contraception abs_yi2 abs_yi abs_vi
Cavia porcellus Cavia_porcellus M normal/F surgical 0.002 0.003 1 Male normal/ Female sterlized 0.002 0.045 0.001
Cynomys ludovicianus Cynomys_ludovicianus M normal/F surgical -0.050 0.008 2 Male normal/ Female sterlized 0.050 0.084 0.004
Eidolon helvum Eidolon_helvum M normal/F surgical -0.062 0.003 3 Male normal/ Female sterlized 0.062 0.069 0.002
Lemur catta Lemur_catta M normal/F surgical 0.141 0.002 4 Male normal/ Female sterlized 0.141 0.141 0.002
Leptailurus serval Leptailurus_serval M normal/F surgical 0.096 0.004 5 Male normal/ Female sterlized 0.096 0.100 0.004
Lynx rufus Lynx_rufus M normal/F surgical 0.294 0.004 6 Male normal/ Female sterlized 0.294 0.294 0.004
Mustela nigripes Mustela_nigripes M normal/F surgical 0.196 0.006 7 Male normal/ Female sterlized 0.196 0.196 0.006
Nasua nasua Nasua_nasua M normal/F surgical -0.026 0.002 8 Male normal/ Female sterlized 0.026 0.041 0.001
Oryctolagus cuniculus Oryctolagus_cuniculus M normal/F surgical 0.091 0.008 9 Male normal/ Female sterlized 0.091 0.106 0.005
Pan troglodytes Pan_troglodytes M normal/F surgical 0.065 0.005 10 Male normal/ Female sterlized 0.065 0.079 0.003
Panthera leo Panthera_leo M normal/F surgical 0.112 0.002 11 Male normal/ Female sterlized 0.112 0.112 0.002
Papio hamadryas Papio_hamadryas M normal/F surgical 0.132 0.005 12 Male normal/ Female sterlized 0.132 0.133 0.004
Procyon lotor Procyon_lotor M normal/F surgical 0.087 0.002 13 Male normal/ Female sterlized 0.087 0.088 0.002
Rattus norvegicus Rattus_norvegicus M normal/F surgical -0.013 0.010 14 Male normal/ Female sterlized 0.013 0.079 0.004
Saguinus oedipus Saguinus_oedipus M normal/F surgical 0.168 0.007 15 Male normal/ Female sterlized 0.168 0.169 0.007
Suricata suricatta Suricata_suricatta M normal/F surgical 0.256 0.002 16 Male normal/ Female sterlized 0.256 0.256 0.002
Aonyx cinerea Aonyx_cinerea M hormonal/F normal -0.465 0.071 17 Male sterlized/ Female normal 0.465 0.473 0.063
Lycaon pictus Lycaon_pictus M hormonal/F normal -0.374 0.058 18 Male sterlized/ Female normal 0.374 0.386 0.048
Macaca silenus Macaca_silenus M hormonal/F normal -0.289 0.066 19 Male sterlized/ Female normal 0.289 0.322 0.045
Mandrillus sphinx Mandrillus_sphinx M hormonal/F normal -0.368 0.063 20 Male sterlized/ Female normal 0.368 0.384 0.051
Saguinus oedipus Saguinus_oedipus M hormonal/F normal -0.119 0.059 21 Male sterlized/ Female normal 0.119 0.216 0.026
Suricata suricatta Suricata_suricatta M hormonal/F normal -0.022 0.056 22 Male sterlized/ Female normal 0.022 0.190 0.021
Cavia porcellus Cavia_porcellus M hormonal/F normal 0.190 0.008 23 Male sterlized/ Female normal 0.190 0.191 0.008
Cynomys ludovicianus Cynomys_ludovicianus M hormonal/F normal 0.014 0.020 24 Male sterlized/ Female normal 0.014 0.112 0.007
Eidolon helvum Eidolon_helvum M hormonal/F normal -0.338 0.004 25 Male sterlized/ Female normal 0.338 0.338 0.004
Lemur catta Lemur_catta M hormonal/F normal 0.053 0.010 26 Male sterlized/ Female normal 0.053 0.091 0.005
Leptailurus serval Leptailurus_serval M hormonal/F normal -0.236 0.011 27 Male sterlized/ Female normal 0.236 0.236 0.011
Lynx rufus Lynx_rufus M hormonal/F normal 0.150 0.006 28 Male sterlized/ Female normal 0.150 0.151 0.006
Mustela nigripes Mustela_nigripes M hormonal/F normal 0.153 0.007 29 Male sterlized/ Female normal 0.153 0.155 0.006
Nasua nasua Nasua_nasua M hormonal/F normal -0.122 0.009 30 Male sterlized/ Female normal 0.122 0.131 0.007
Oryctolagus cuniculus Oryctolagus_cuniculus M hormonal/F normal -0.111 0.014 31 Male sterlized/ Female normal 0.111 0.134 0.009
Pan troglodytes Pan_troglodytes M hormonal/F normal -0.365 0.008 32 Male sterlized/ Female normal 0.365 0.365 0.008
Panthera leo Panthera_leo M hormonal/F normal 0.074 0.002 33 Male sterlized/ Female normal 0.074 0.075 0.001
Papio hamadryas Papio_hamadryas M hormonal/F normal -0.276 0.004 34 Male sterlized/ Female normal 0.276 0.276 0.004
Procyon lotor Procyon_lotor M hormonal/F normal -0.207 0.003 35 Male sterlized/ Female normal 0.207 0.207 0.003
Rattus norvegicus Rattus_norvegicus M hormonal/F normal -0.171 0.018 36 Male sterlized/ Female normal 0.171 0.183 0.013
Saguinus oedipus Saguinus_oedipus M hormonal/F normal 0.219 0.022 37 Male sterlized/ Female normal 0.219 0.227 0.018
Suricata suricatta Suricata_suricatta M hormonal/F normal 0.207 0.006 38 Male sterlized/ Female normal 0.207 0.207 0.005
Cavia porcellus Cavia_porcellus M surgical/F surgical 0.225 0.011 39 Male sterlized/ Female sterlized 0.225 0.226 0.011
Cynomys ludovicianus Cynomys_ludovicianus M surgical/F surgical -0.067 0.026 40 Male sterlized/ Female sterlized 0.067 0.140 0.011
Eidolon helvum Eidolon_helvum M surgical/F surgical -0.224 0.005 41 Male sterlized/ Female sterlized 0.224 0.224 0.005
Lemur catta Lemur_catta M surgical/F surgical 0.151 0.012 42 Male sterlized/ Female sterlized 0.151 0.159 0.009
Leptailurus serval Leptailurus_serval M surgical/F surgical -0.056 0.013 43 Male sterlized/ Female sterlized 0.056 0.103 0.006
Lynx rufus Lynx_rufus M surgical/F surgical 0.305 0.007 44 Male sterlized/ Female sterlized 0.305 0.305 0.007
Mustela nigripes Mustela_nigripes M surgical/F surgical 0.172 0.010 45 Male sterlized/ Female sterlized 0.172 0.175 0.009
Nasua nasua Nasua_nasua M surgical/F surgical 0.010 0.010 46 Male sterlized/ Female sterlized 0.010 0.080 0.004
Oryctolagus cuniculus Oryctolagus_cuniculus M surgical/F surgical -0.129 0.019 47 Male sterlized/ Female sterlized 0.129 0.156 0.012
Pan troglodytes Pan_troglodytes M surgical/F surgical -0.065 0.011 48 Male sterlized/ Female sterlized 0.065 0.099 0.005
Panthera leo Panthera_leo M surgical/F surgical 0.045 0.003 49 Male sterlized/ Female sterlized 0.045 0.056 0.002
Papio hamadryas Papio_hamadryas M surgical/F surgical -0.101 0.007 50 Male sterlized/ Female sterlized 0.101 0.110 0.005
Procyon lotor Procyon_lotor M surgical/F surgical 0.037 0.004 51 Male sterlized/ Female sterlized 0.037 0.060 0.002
Rattus norvegicus Rattus_norvegicus M surgical/F surgical -0.150 0.025 52 Male sterlized/ Female sterlized 0.150 0.179 0.016
Saguinus oedipus Saguinus_oedipus M surgical/F surgical 0.270 0.028 53 Male sterlized/ Female sterlized 0.270 0.277 0.024
Suricata suricatta Suricata_suricatta M surgical/F surgical 0.236 0.007 54 Male sterlized/ Female sterlized 0.236 0.236 0.007
Aonyx cinerea Aonyx_cinerea M normal/F normal -0.309 0.001 55 Male normal/ Female normal 0.309 0.309 0.001
Lycaon pictus Lycaon_pictus M normal/F normal -0.313 0.002 56 Male normal/ Female normal 0.313 0.313 0.002
Macaca silenus Macaca_silenus M normal/F normal -0.240 0.005 57 Male normal/ Female normal 0.240 0.240 0.005
Mandrillus sphinx Mandrillus_sphinx M normal/F normal -0.201 0.004 58 Male normal/ Female normal 0.201 0.201 0.004
Saguinus oedipus Saguinus_oedipus M normal/F normal 0.038 0.001 59 Male normal/ Female normal 0.038 0.042 0.001
Suricata suricatta Suricata_suricatta M normal/F normal 0.071 0.000 60 Male normal/ Female normal 0.071 0.071 0.000
Cavia porcellus Cavia_porcellus M normal/F normal -0.034 0.000 61 Male normal/ Female normal 0.034 0.035 0.000
Cynomys ludovicianus Cynomys_ludovicianus M normal/F normal 0.031 0.002 62 Male normal/ Female normal 0.031 0.043 0.001
Eidolon helvum Eidolon_helvum M normal/F normal -0.176 0.002 63 Male normal/ Female normal 0.176 0.176 0.002
Lemur catta Lemur_catta M normal/F normal 0.044 0.000 64 Male normal/ Female normal 0.044 0.044 0.000
Leptailurus serval Leptailurus_serval M normal/F normal -0.084 0.002 65 Male normal/ Female normal 0.084 0.085 0.002
Lynx rufus Lynx_rufus M normal/F normal 0.139 0.003 66 Male normal/ Female normal 0.139 0.139 0.003
Mustela nigripes Mustela_nigripes M normal/F normal 0.177 0.003 67 Male normal/ Female normal 0.177 0.177 0.003
Nasua nasua Nasua_nasua M normal/F normal -0.159 0.001 68 Male normal/ Female normal 0.159 0.159 0.001
Oryctolagus cuniculus Oryctolagus_cuniculus M normal/F normal 0.108 0.003 69 Male normal/ Female normal 0.108 0.110 0.003
Pan troglodytes Pan_troglodytes M normal/F normal -0.234 0.003 70 Male normal/ Female normal 0.234 0.234 0.003
Panthera leo Panthera_leo M normal/F normal 0.140 0.001 71 Male normal/ Female normal 0.140 0.140 0.001
Papio hamadryas Papio_hamadryas M normal/F normal -0.043 0.002 72 Male normal/ Female normal 0.043 0.049 0.001
Procyon lotor Procyon_lotor M normal/F normal -0.157 0.001 73 Male normal/ Female normal 0.157 0.157 0.001
Rattus norvegicus Rattus_norvegicus M normal/F normal -0.034 0.002 74 Male normal/ Female normal 0.034 0.046 0.001
Saguinus oedipus Saguinus_oedipus M normal/F normal 0.117 0.001 75 Male normal/ Female normal 0.117 0.117 0.001
Suricata suricatta Suricata_suricatta M normal/F normal 0.226 0.000 76 Male normal/ Female normal 0.226 0.226 0.000
Aonyx cinerea Aonyx_cinerea M normal/F hornomal -0.177 0.010 77 NA 0.177 0.180 0.009
Lycaon pictus Lycaon_pictus M normal/F hornomal -0.330 0.011 78 NA 0.330 0.330 0.011
Macaca silenus Macaca_silenus M normal/F hornomal -0.182 0.025 79 NA 0.182 0.201 0.017
Mandrillus sphinx Mandrillus_sphinx M normal/F hornomal -0.236 0.019 80 NA 0.236 0.241 0.017
Saguinus oedipus Saguinus_oedipus M normal/F hornomal 0.015 0.018 81 NA 0.015 0.107 0.007
Suricata suricatta Suricata_suricatta M normal/F hornomal 0.153 0.006 82 NA 0.153 0.154 0.005
Aonyx cinerea Aonyx_cinerea M hornomal/F hornomal -0.332 0.013 83 Male sterlized/ Female sterlized 0.332 0.333 0.013
Lycaon pictus Lycaon_pictus M hornomal/F hornomal -0.391 0.016 84 Male sterlized/ Female sterlized 0.391 0.391 0.015
Macaca silenus Macaca_silenus M hornomal/F hornomal -0.231 0.032 85 Male sterlized/ Female sterlized 0.231 0.248 0.024
Mandrillus sphinx Mandrillus_sphinx M hornomal/F hornomal -0.403 0.020 86 Male sterlized/ Female sterlized 0.403 0.403 0.020
Saguinus oedipus Saguinus_oedipus M hornomal/F hornomal -0.142 0.021 87 Male sterlized/ Female sterlized 0.142 0.166 0.013
Suricata suricatta Suricata_suricatta M hornomal/F hornomal 0.059 0.007 88 Male sterlized/ Female sterlized 0.059 0.083 0.004

21 Analysis set 1: contraceptive vs. normal

Code
# variance-covariance matrix for sampling error assuming 0.5 correlation
VCV <- vcalc(vi = dat_all$vi, 
             cluster = dat_all$species, 
             obs = dat_all$obs_id,
             rho = 0.5, 
             data = dat_all)


mod_all <- rma.mv(yi, V = VCV,
                     random = list(
                       ~1|species,
                       ~1|phylogeny,
                       ~1|obs_id),
                     R = list(phylogeny = cor_tree),
                     data = dat_all,
                     test = "t",
                     sparse = TRUE)
summary(mod_all)

Multivariate Meta-Analysis Model (k = 154; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  63.4653  -126.9306  -118.9306  -106.8089  -118.6603   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0007  0.0272    114     no    species   no 
sigma^2.2  0.0047  0.0688    114     no  phylogeny  yes 
sigma^2.3  0.0097  0.0987    154     no     obs_id   no 

Test for Heterogeneity:
Q(df = 153) = 451.1870, p-val < .0001

Model Results:

estimate      se    tval   df    pval   ci.lb   ci.ub    
  0.0994  0.0445  2.2340  153  0.0269  0.0115  0.1872  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_all), 2)
    I2_Total   I2_species I2_phylogeny    I2_obs_id 
       70.07         3.42        21.76        44.89 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_all, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
mod_all1 <- rma.mv(yi, V = VCV,
                   mod = ~ sex,
                  random = list(
                    ~1|species,
                    ~1|phylogeny,
                    ~1|obs_id),
                  R = list(phylogeny = cor_tree),
                  data = dat_all,
                  test = "t",
                  sparse = TRUE)
summary(mod_all1)

Multivariate Meta-Analysis Model (k = 154; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  62.4534  -124.9069  -114.9069   -99.7875  -114.4959   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0004  0.0212    114     no    species   no 
sigma^2.2  0.0048  0.0691    114     no  phylogeny  yes 
sigma^2.3  0.0101  0.1006    154     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 152) = 448.6429, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 152) = 0.0004, p-val = 0.9844

Model Results:

         estimate      se    tval   df    pval    ci.lb   ci.ub    
intrcpt    0.0990  0.0483  2.0484  152  0.0422   0.0035  0.1944  * 
sexmale    0.0005  0.0243  0.0196  152  0.9844  -0.0475  0.0485    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
mod_all1b <- rma.mv(yi, V = VCV,
                   mod = ~ sex - 1,
                   random = list(
                     ~1|species,
                     ~1|phylogeny,
                     ~1|obs_id),
                   R = list(phylogeny = cor_tree),
                   data = dat_all,
                   test = "t",
                   sparse = TRUE)
summary(mod_all1b)

Multivariate Meta-Analysis Model (k = 154; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  62.4534  -124.9069  -114.9069   -99.7875  -114.4959   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0004  0.0212    114     no    species   no 
sigma^2.2  0.0048  0.0691    114     no  phylogeny  yes 
sigma^2.3  0.0101  0.1006    154     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 152) = 448.6429, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 152) = 2.4724, p-val = 0.0878

Model Results:

           estimate      se    tval   df    pval   ci.lb   ci.ub    
sexfemale    0.0990  0.0483  2.0484  152  0.0422  0.0035  0.1944  * 
sexmale      0.0994  0.0451  2.2071  152  0.0288  0.0104  0.1885  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_all1), 5)
   R2_marginal R2_conditional 
       0.00000        0.34046 
Code
orchard_plot(mod_all1, mod = "sex",
             xlab = "lnRR (all)", group = "species", g = FALSE)

Code
dat_all$type <- factor(dat_all$type, 
                   levels = rev(c("surgical", "hormonal")))

mod_all2 <- rma.mv(yi, V = VCV,
                 mod = ~ type -1,
                 random = list(
                   ~1|species,
                   ~1|phylogeny,
                   ~1|obs_id),
                 R = list(phylogeny = cor_tree),
                 data = dat_all,
                  test = "t",
                  sparse = TRUE)

summary(mod_all2)

Multivariate Meta-Analysis Model (k = 154; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  62.4737  -124.9473  -114.9473   -99.8279  -114.5364   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0003  0.0165    114     no    species   no 
sigma^2.2  0.0047  0.0684    114     no  phylogeny  yes 
sigma^2.3  0.0103  0.1014    154     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 152) = 447.7283, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 152) = 2.5200, p-val = 0.0838

Model Results:

              estimate      se    tval   df    pval   ci.lb   ci.ub    
typehormonal    0.1012  0.0485  2.0850  152  0.0387  0.0053  0.1970  * 
typesurgical    0.0989  0.0446  2.2175  152  0.0281  0.0108  0.1870  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# R^2 - hardly any
round(r2_ml(mod_all2)*100, 5)
   R2_marginal R2_conditional 
       0.00759       32.51422 
Code
orchard_plot(mod_all2, mod = "type",
             xlab = "lnRR (all)", group = "species", g = FALSE, angle = 90)

Code
# result table
all_models(mod_all2, mod = "type")
Fixed effect Estimate Lower CI [0.025] Upper CI [0.975] P value Lower PI [0.025] Upper PI [0.975]
Hormonal 0.101 0.005 0.197 0.039 -0.161 0.363
Surgical 0.099 0.011 0.187 0.028 -0.160 0.358
Hormonal-Surgical -0.002 -0.051 0.047 0.929 -0.249 0.245
Code
# creating a new variable combining sex and type
dat_all$sex_type <- as.factor(paste(dat_all$sex, dat_all$type, sep = "_"))

mod_all3 <- rma.mv(yi, V = VCV,
                 mod = ~ sex_type -1,
                 random = list(
                   ~1|species,
                   ~1|phylogeny,
                   ~1|obs_id),
                 R = list(phylogeny = cor_tree),
                 data = dat_all,
                  test = "t",
                  sparse = TRUE)

summary(mod_all3)

Multivariate Meta-Analysis Model (k = 154; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  61.8583  -123.7165  -109.7165   -88.6421  -108.9278   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0000  0.0001    114     no    species   no 
sigma^2.2  0.0046  0.0680    114     no  phylogeny  yes 
sigma^2.3  0.0107  0.1035    154     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 150) = 447.6126, p-val < .0001

Test of Moderators (coefficients 1:4):
F(df1 = 4, df2 = 150) = 1.2790, p-val = 0.2808

Model Results:

                         estimate      se    tval   df    pval    ci.lb   ci.ub 
sex_typefemale_hormonal    0.1010  0.0485  2.0814  150  0.0391   0.0051  0.1968 
sex_typefemale_surgical    0.0937  0.0621  1.5079  150  0.1337  -0.0291  0.2165 
sex_typemale_hormonal      0.1224  0.2654  0.4611  150  0.6454  -0.4021  0.6468 
sex_typemale_surgical      0.0993  0.0445  2.2311  150  0.0272   0.0114  0.1872 
                           
sex_typefemale_hormonal  * 
sex_typefemale_surgical    
sex_typemale_hormonal      
sex_typemale_surgical    * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# R^2 - hardly any
round(r2_ml(mod_all3)*100, 5)
   R2_marginal R2_conditional 
       0.16621       30.26889 
Code
orchard_plot(mod_all3, mod = "sex_type",
             xlab = "lnRR (all)", group = "species", g = FALSE, angle = 90)

Code
# result table
all_models(mod_all3, mod = "sex_type")
Fixed effect Estimate Lower CI [0.025] Upper CI [0.975] P value Lower PI [0.025] Upper PI [0.975]
Female_hormonal 0.101 0.005 0.197 0.039 -0.162 0.364
Female_surgical 0.094 -0.029 0.216 0.134 -0.180 0.367
Male_hormonal 0.122 -0.402 0.647 0.645 -0.456 0.701
Male_surgical 0.099 0.011 0.187 0.027 -0.161 0.359
Female_hormonal-Female_surgical -0.007 -0.100 0.086 0.878 -0.267 0.253
Female_hormonal-Male_hormonal 0.021 -0.491 0.534 0.935 -0.546 0.588
Female_hormonal-Male_surgical -0.002 -0.053 0.049 0.949 -0.250 0.246
Female_surgical-Male_hormonal 0.029 -0.484 0.541 0.913 -0.539 0.596
Female_surgical-Male_surgical 0.006 -0.085 0.096 0.904 -0.254 0.265
Male_hormonal-Male_surgical -0.023 -0.536 0.490 0.930 -0.591 0.544

22 Analysis set 2: sex difference

Code
# variance-covariance matrix for sampling error assuming 0.5 correlation
VCV <- vcalc(vi = dat_comb$vi, 
             cluster = dat_comb$species, 
             obs = dat_comb$obs_id,
             rho = 0.5, 
             data = dat_comb)

mod_comb <- rma.mv(yi, V = VCV,
                   mods = ~contraception - 1,
                   random = list(
                     ~1|species,
                     ~1|phylogeny,
                     ~1|obs_id),
                   R = list(phylogeny = cor_tree),
                   data = dat_comb,
                   control = list(optimizer = "Nelder-Mead"),
                    test = "t",
                  sparse = TRUE)
summary(mod_comb)

Multivariate Meta-Analysis Model (k = 82; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 47.0117  -94.0234  -80.0234  -63.5264  -78.4234   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0183  0.1351     20     no    species   no 
sigma^2.2  0.0041  0.0642     20     no  phylogeny  yes 
sigma^2.3  0.0051  0.0714     82     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 78) = 780.6119, p-val < .0001

Test of Moderators (coefficients 1:4):
F(df1 = 4, df2 = 78) = 6.6866, p-val = 0.0001

Model Results:

                                                estimate      se     tval  df 
contraceptionMale sterlized/\nFemale sterlized   -0.0367  0.0644  -0.5701  78 
contraceptionMale sterlized/\nFemale normal      -0.1080  0.0646  -1.6708  78 
contraceptionMale normal/\nFemale sterlized       0.0492  0.0631   0.7799  78 
contraceptionMale normal/\nFemale normal         -0.0518  0.0608  -0.8526  78 
                                                  pval    ci.lb   ci.ub    
contraceptionMale sterlized/\nFemale sterlized  0.5703  -0.1649  0.0915    
contraceptionMale sterlized/\nFemale normal     0.0988  -0.2366  0.0207  . 
contraceptionMale normal/\nFemale sterlized     0.4378  -0.0764  0.1747    
contraceptionMale normal/\nFemale normal        0.3965  -0.1728  0.0692    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_comb)*100, 5)
   R2_marginal R2_conditional 
       9.41548       83.17844 
Code
#robust(mod_comb, cluster = species)  

orchard_plot(mod_comb, mod = "contraception",
             xlab = "log response ratio (lnRR)", group = "species", 
             g = FALSE, angle = 45)

Code
all_models(mod_comb, mod = "contraception")  
Fixed effect Estimate Lower CI [0.025] Upper CI [0.975] P value Lower PI [0.025] Upper PI [0.975]
Male sterlized/ Female sterlized -0.037 -0.165 0.091 0.570 -0.391 0.317
Male sterlized/ Female normal -0.108 -0.237 0.021 0.099 -0.462 0.246
Male normal/ Female sterlized 0.049 -0.076 0.175 0.438 -0.304 0.402
Male normal/ Female normal -0.052 -0.173 0.069 0.397 -0.403 0.300
Male sterlized/ Female sterlized-Male sterlized/ Female normal -0.071 -0.134 -0.009 0.026 -0.402 0.260
Male sterlized/ Female sterlized-Male normal/ Female sterlized 0.086 0.024 0.148 0.007 -0.245 0.417
Male sterlized/ Female sterlized-Male normal/ Female normal -0.015 -0.073 0.043 0.612 -0.345 0.315
Male sterlized/ Female normal-Male normal/ Female sterlized 0.157 0.095 0.219 0.000 -0.174 0.488
Male sterlized/ Female normal-Male normal/ Female normal 0.056 -0.003 0.116 0.065 -0.274 0.387
Male normal/ Female sterlized-Male normal/ Female normal -0.101 -0.156 -0.046 0.000 -0.430 0.229
Code
# adding only model figs
# plotting just male analyses - adjusting mod_comp_sex

res_sex <- mod_results(mod_comb, mod = "contraception", group = "species")

attr(res_sex, "class") <- NULL

res_sex$mod_table <- res_sex$mod_table[c(2, 4), ]
res_sex$data <- res_sex$data %>% filter(moderator == "Male sterlized/\nFemale normal"| moderator ==  "Male normal/\nFemale normal") 

res_sex2 <- res_sex

class(res_sex2) <-  c("orchard", "data.frame")

d01 <- orchard_plot(res_sex2, mod = "contraception", xlab = "log response ratio (lnRR)", 
                   group = "species", 
                   cb = T, flip = FALSE) 

d01

Code
# variance-covariance matrix for sampling error assuming 0.5 correlation

VCVa <- vcalc(vi = dat_comb$abs_vi, 
             cluster = dat_comb$species, 
             obs = dat_comb$obs_id,
             rho = 0.5, 
             data = dat_comb)



mod_comb_a <- rma.mv(abs_yi, V = VCVa,
                     mods = ~contraception - 1,
                     random = list(
                       ~1|species,
                       ~1|phylogeny,
                       ~1|obs_id),
                     R = list(phylogeny = cor_tree),
                     data = dat_comb,
                     control = list(optimizer = "Nelder-Mead"),
                      test = "t",
                     sparse = TRUE)
summary(mod_comb_a)

Multivariate Meta-Analysis Model (k = 82; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  78.3730  -156.7461  -142.7461  -126.2491  -141.1461   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0009  0.0296     20     no    species   no 
sigma^2.2  0.0015  0.0390     20     no  phylogeny  yes 
sigma^2.3  0.0035  0.0591     82     no     obs_id   no 

Test for Residual Heterogeneity:
QE(df = 78) = 384.1271, p-val < .0001

Test of Moderators (coefficients 1:4):
F(df1 = 4, df2 = 78) = 5.7942, p-val = 0.0004

Model Results:

                                                estimate      se    tval  df 
contraceptionMale sterlized/\nFemale sterlized    0.1451  0.0383  3.7864  78 
contraceptionMale sterlized/\nFemale normal       0.1852  0.0389  4.7650  78 
contraceptionMale normal/\nFemale sterlized       0.1199  0.0366  3.2741  78 
contraceptionMale normal/\nFemale normal          0.1240  0.0342  3.6227  78 
                                                  pval   ci.lb   ci.ub      
contraceptionMale sterlized/\nFemale sterlized  0.0003  0.0688  0.2214  *** 
contraceptionMale sterlized/\nFemale normal     <.0001  0.1078  0.2626  *** 
contraceptionMale normal/\nFemale sterlized     0.0016  0.0470  0.1928   ** 
contraceptionMale normal/\nFemale normal        0.0005  0.0559  0.1922  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_comb_a)*100, 5)
   R2_marginal R2_conditional 
      10.38107       46.81997 
Code
#robust(mod_comb_a, cluster = species)  

orchard_plot(mod_comb_a, mod = "contraception",
             xlab = "absolute log response ratio (lnRR)", group = "species", 
             g = FALSE, angle = 45)

Code
all_models(mod_comb_a, mod = "contraception", type = "abs")
Fixed effect Estimate Lower CI [0.025] Upper CI [0.975] P value Lower PI [0.025] Upper PI [0.975]
Male sterlized/ Female sterlized 0.145 0.069 0.221 0.000 -0.026 0.316
Male sterlized/ Female normal 0.185 0.108 0.263 0.000 0.014 0.357
Male normal/ Female sterlized 0.120 0.047 0.193 0.002 -0.049 0.289
Male normal/ Female normal 0.124 0.056 0.192 0.001 -0.043 0.291
Male sterlized/ Female sterlized-Male sterlized/ Female normal 0.040 -0.012 0.093 0.134 -0.119 0.199
Male sterlized/ Female sterlized-Male normal/ Female sterlized -0.025 -0.076 0.026 0.335 -0.184 0.134
Male sterlized/ Female sterlized-Male normal/ Female normal -0.021 -0.069 0.027 0.389 -0.179 0.137
Male sterlized/ Female normal-Male normal/ Female sterlized -0.065 -0.118 -0.013 0.015 -0.225 0.094
Male sterlized/ Female normal-Male normal/ Female normal -0.061 -0.111 -0.011 0.016 -0.220 0.097
Male normal/ Female sterlized-Male normal/ Female normal 0.004 -0.041 0.049 0.858 -0.153 0.161
Code
# plotting just male analyses - adjusting mod_comp_sex

res_sex_ab <- mod_results(mod_comb_a, mod = "contraception", group = "species")

attr(res_sex_ab, "class") <- NULL

res_sex_ab$mod_table <- res_sex_ab$mod_table[c(2, 4), ]
res_sex_ab$data <- res_sex_ab$data %>% filter(moderator == "Male sterlized/\nFemale normal"| moderator ==  "Male normal/\nFemale normal") 

res_sex_ab2 <- res_sex_ab

class(res_sex_ab2) <-  c("orchard", "data.frame")

d11 <- orchard_plot(res_sex_ab2, mod = "contraception", xlab = "log response ratio (lnRR)", 
                   group = "species", 
                   cb = T, flip = FALSE) 

d11

Code
d01 / d11

Code
# saving results for figs rds

saveRDS(res_sex2, file = here("Rdata", "fig", "res_sex_zoo.rds"))
saveRDS(res_sex_abs2, file = here("Rdata", "fig", "res_sex_zoo_abs.rds"))

23 Pre-post puberty analysis

This analysis compares the effect size of the lifespan extension before and after puberty.

23.1 Loading data and obtaining effect isze

Code
#dat0 <- read_csv(here("data", "zoo", "timing_male.csv"), na = c("", "NA"))
dat0 <- read_csv(here("data", "zoo", "resultsBaSTAbefAftMatur.csv"), na = c("", "NA"))


# phylogeny
# read RData
#dford 

load(here("Rdata", "zoo", "maxCredTreeMammals.RData"))

tree <- maxCred #read.tree(here("data", "zoo", "tree_zoo.tre"))

# taxonomy
tax <- read.csv(here("data", "zoo", "species_merge_list.csv"))

dat0 %>% left_join(tax, by = c("Species" = "ZIMSSpecies")) -> dat_full

# talking out species with no data (Pseudocheirus peregrinus = likely to be mistaks in data)
# dat_full %>% filter(Species != "Chrysocyon brachyurus" &
#                     Species != "Crocuta crocuta" &
#                     Species != "Neofelis nebulosa" &
#                     Species != "Panthera uncia" &
#                     Species != "Pseudocheirus peregrinus") %>% 
#   mutate(phylogeny = gsub(" ", "_", vertlife.species)) -> dat

dat_full %>% 
  mutate(phylogeny = gsub(" ", "_", vertlife.treename)) -> dat1

# adding Cervus canadensis
# dat$vertlife.species[which(dat$Species == "Cervus canadensis")] <-"Cervus canadensis"
# dat$phylogeny[which(dat$Species == "Cervus canadensis")] <-"Cervus_canadensis"

# fixing species names
#dat$Species[dat$Species == "Equus asinus"] <- "Equus_africanus"
dat1$Species[dat1$Species == "Aonyx cinereus"] <- "Aonyx cinerea"
#dat$Species[dat$Species == "Bubalus bubalis"] <- "Bubalus arnee"


# life span data 
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% unique(dat1$phylogeny)))]

tree <- drop.tip(tree, to_drop)

# checking the number of spp
#length(tree$tip.label)

tree <- as.ultrametric(tree)

#tree <- compute.brlen(tree)
cor_tree <- vcv(tree, corr = TRUE)


missing <- which(is.na(dat$phylogeny))

dat$Species[missing]
NULL
Code
# creating effect size 

dat <- escalc("ROM", 
                    m2i = LifeExpContraAft,
                    m1i = LifeExpContraBef,
                    sd2i = SEcontraAft*sqrt(NContraAft),
                    sd1i = SEcontraBef*sqrt(NContraBef), 
                    n2i = NContraAft,
                    n1i = NContraBef,
                    data = dat1
)

dat$species <- factor(dat$Species)

# another dataset where we have lnRR for both pre and post puberty

dat2 <- escalc("ROM", 
                    m1i = LifeExpContraBef,
                    m2i = LifeExpNoContra,
                    sd1i = SEcontraBef*sqrt(NContraBef),
                    sd2i = SEnoContra*sqrt(NnoContra),
                    n1i = NContraBef,
                    n2i = NnoContra,
                    data = dat1
)


dat3 <- escalc("ROM", 
                    m1i = LifeExpContraAft,
                    m2i = LifeExpNoContra,
                    sd1i = SEcontraAft*sqrt(NContraAft),
                    sd2i = SEnoContra*sqrt(NnoContra),
                    n1i = NContraAft,
                    n2i = NnoContra,
                    data = dat1
)

dat_long <- rbind(dat2, dat3)

dat_long$pairID <- rep(1:nrow(dat), 2)

dat_long$species <- factor(dat_long$Species)

# pre-post
dat_long$pre_post <- c(rep("pre", nrow(dat)), rep("post", nrow(dat)))

23.2 Meta-analysis and meta-regression

Code
# meta-analysis

# variance-covariance matrix for sampling error assuming 0.5 correlation

mod_pp <- rma.mv(yi, V = vi,
                  random = list(
                    ~1|species,
                    ~1|phylogeny),
                  R = list(phylogeny = cor_tree),
                  data = dat,
                  test = "t",
                  sparse = TRUE)
summary(mod_pp)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.1930  -40.3860  -34.3860  -28.9660  -33.8006   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0006  0.0252     46     no    species   no 
sigma^2.2  0.0107  0.1033     46     no  phylogeny  yes 

Test for Heterogeneity:
Q(df = 45) = 56.2752, p-val = 0.1209

Model Results:

estimate      se    tval  df    pval    ci.lb   ci.ub    
  0.0648  0.0662  0.9789  45  0.3329  -0.0685  0.1982    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_pp), 5)
    I2_Total   I2_species I2_phylogeny 
    41.54681      2.33760     39.20922 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_pp, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# data set excluding primates

dat %>% filter(Primate == "No") -> dat_short


mod_pp2 <- rma.mv(yi, V = vi,
                 random = list(
                   ~1|species,
                   ~1|phylogeny),
                 R = list(phylogeny = cor_tree),
                 data = dat_short,
                  test = "t",
                  sparse = TRUE)
summary(mod_pp2)

Multivariate Meta-Analysis Model (k = 36; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 18.3479  -36.6958  -30.6958  -26.0297  -29.9216   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0021  0.0460     36     no    species   no 
sigma^2.2  0.0018  0.0420     36     no  phylogeny  yes 

Test for Heterogeneity:
Q(df = 35) = 38.5141, p-val = 0.3135

Model Results:

estimate      se    tval  df    pval   ci.lb   ci.ub    
  0.0830  0.0360  2.3028  35  0.0274  0.0098  0.1561  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_pp2), 5)
    I2_Total   I2_species I2_phylogeny 
    20.91951     11.41737      9.50214 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_pp2, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# primate as moderator

mod_pp3 <- rma.mv(yi, V = vi,
                  mod = ~ Primate,
                  random = list(
                    ~1|species,
                    ~1|phylogeny),
                  R = list(phylogeny = cor_tree),
                  data = dat,
                   test = "t",
                  sparse = TRUE)
summary(mod_pp3)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.8267  -41.6535  -33.6535  -26.5167  -32.6279   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0024  0.0488     46     no    species   no 
sigma^2.2  0.0026  0.0511     46     no  phylogeny  yes 

Test for Residual Heterogeneity:
QE(df = 44) = 50.4050, p-val = 0.2350

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 44) = 4.0940, p-val = 0.0491

Model Results:

            estimate      se     tval  df    pval    ci.lb    ci.ub    
intrcpt       0.0843  0.0408   2.0689  44  0.0445   0.0022   0.1665  * 
PrimateYes   -0.1316  0.0651  -2.0234  44  0.0491  -0.2628  -0.0005  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_pp3), 5)
    R2_marginal R2_conditional1 R2_conditional2 
        0.37649         0.70212         0.67436 
Code
mod_pp3b <- rma.mv(yi, V = vi,
                  mod = ~ Primate - 1,
                  random = list(
                    ~1|species,
                    ~1|phylogeny),
                  R = list(phylogeny = cor_tree),
                  data = dat,
                   test = "t",
                  sparse = TRUE)
summary(mod_pp3b)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.8267  -41.6535  -33.6535  -26.5167  -32.6279   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0024  0.0488     46     no    species   no 
sigma^2.2  0.0026  0.0511     46     no  phylogeny  yes 

Test for Residual Heterogeneity:
QE(df = 44) = 50.4050, p-val = 0.2350

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 44) = 3.2731, p-val = 0.0473

Model Results:

            estimate      se     tval  df    pval    ci.lb   ci.ub    
PrimateNo     0.0843  0.0408   2.0689  44  0.0445   0.0022  0.1665  * 
PrimateYes   -0.0473  0.0664  -0.7124  44  0.4800  -0.1812  0.0866    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
orchard_plot(mod_pp3, mod = "Primate", xlab = "lnRR (all)", group = "species", g = FALSE)

Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_pp2, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# no phylogeny

mod_np <- rma.mv(yi, V = vi,
                 random = list(
                   ~1|species),
                 data = dat,
                  test = "t",
                  sparse = TRUE)
summary(mod_np)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 18.5945  -37.1891  -33.1891  -29.5757  -32.9034   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2    0.0027  0.0522     46     no  species 

Test for Heterogeneity:
Q(df = 45) = 56.2752, p-val = 0.1209

Model Results:

estimate      se    tval  df    pval   ci.lb   ci.ub     
  0.0562  0.0207  2.7146  45  0.0094  0.0145  0.0980  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_np), 5)
  I2_Total I2_species 
  14.61126   14.61126 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_np, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# phlo - primates as a separate group 
mod_np2 <- rma.mv(yi, V = vi,
                 mod = ~ Primate,
                 random = list(
                   ~1|species),
                 data = dat,
                  test = "t",
                  sparse = TRUE)
summary(mod_np2)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.7305  -41.4610  -35.4610  -30.1084  -34.8610   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2    0.0032  0.0563     46     no  species 

Test for Residual Heterogeneity:
QE(df = 44) = 50.4050, p-val = 0.2350

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 44) = 6.1333, p-val = 0.0172

Model Results:

            estimate      se     tval  df    pval    ci.lb    ci.ub     
intrcpt       0.0795  0.0230   3.4506  44  0.0012   0.0330   0.1259  ** 
PrimateYes   -0.1404  0.0567  -2.4765  44  0.0172  -0.2547  -0.0261   * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_np2), 5)
   R2_marginal R2_conditional 
       0.51948        0.51948 
Code
mod_np2b <- rma.mv(yi, V = vi,
                 mod = ~ Primate -1,
                 random = list(
                   ~1|species),
                 data = dat,
                  test = "t",
                  sparse = TRUE)
summary(mod_np2b)

Multivariate Meta-Analysis Model (k = 46; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 20.7305  -41.4610  -35.4610  -30.1084  -34.8610   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2    0.0032  0.0563     46     no  species 

Test for Residual Heterogeneity:
QE(df = 44) = 50.4050, p-val = 0.2350

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 44) = 6.6456, p-val = 0.0030

Model Results:

            estimate      se     tval  df    pval    ci.lb   ci.ub     
PrimateNo     0.0795  0.0230   3.4506  44  0.0012   0.0330  0.1259  ** 
PrimateYes   -0.0610  0.0518  -1.1767  44  0.2456  -0.1654  0.0435     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_np2, mod = "Primate", xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# meta-analysis

# variance-covariance matrix for sampling error assuming 0.5 correlation

mod_pp2 <- rma.mv(yi, V = vi,
                  random = list(
                    ~1|species,
                    ~1|phylogeny,
                    ~1|pairID),
                  R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_pp2)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 33.9039  -67.8079  -59.8079  -49.7645  -59.3428   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0077  0.0877     46     no    species   no 
sigma^2.2  0.0104  0.1021     46     no  phylogeny  yes 
sigma^2.3  0.0077  0.0877     46     no     pairID   no 

Test for Heterogeneity:
Q(df = 91) = 303.2831, p-val < .0001

Model Results:

estimate      se    tval  df    pval    ci.lb   ci.ub    
  0.1157  0.0672  1.7217  91  0.0885  -0.0178  0.2491  . 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_pp2), 5)
    I2_Total   I2_species I2_phylogeny    I2_pairID 
    76.42277     22.77885     30.86508     22.77885 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_pp2, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
mod_pp3 <- rma.mv(yi, V = vi,
                  mod = ~ pre_post - 1,
                  random = list(
                    ~1|species,
                    ~1|phylogeny,
                    ~1|pairID),
                  R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_pp3)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 36.3442  -72.6885  -62.6885  -50.1894  -61.9742   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0080  0.0892     46     no    species   no 
sigma^2.2  0.0099  0.0996     46     no  phylogeny  yes 
sigma^2.3  0.0080  0.0892     46     no     pairID   no 

Test for Residual Heterogeneity:
QE(df = 90) = 300.4417, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 90) = 5.4475, p-val = 0.0058

Model Results:

              estimate      se    tval  df    pval    ci.lb   ci.ub    
pre_postpost    0.0892  0.0667  1.3388  90  0.1840  -0.0432  0.2217    
pre_postpre     0.1432  0.0667  2.1469  90  0.0345   0.0107  0.2757  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_pp3), 5)
    R2_marginal R2_conditional1 R2_conditional2 R2_conditional3 
        0.02769         0.70051         0.62667         0.70051 
Code
mod_pp3b <- rma.mv(yi, V = vi,
                  mod = ~ pre_post,
                  random = list(
                    ~1|species,
                    ~1|phylogeny,
                    ~1|pairID),
                  R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_pp3b)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 36.3442  -72.6885  -62.6885  -50.1894  -61.9742   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0080  0.0892     46     no    species   no 
sigma^2.2  0.0099  0.0996     46     no  phylogeny  yes 
sigma^2.3  0.0080  0.0892     46     no     pairID   no 

Test for Residual Heterogeneity:
QE(df = 90) = 300.4417, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 90) = 7.8110, p-val = 0.0063

Model Results:

             estimate      se    tval  df    pval    ci.lb   ci.ub     
intrcpt        0.0892  0.0667  1.3388  90  0.1840  -0.0432  0.2217     
pre_postpre    0.0539  0.0193  2.7948  90  0.0063   0.0156  0.0923  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_pp3, mod = "pre_post", xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# meta-analysis

# variance-covariance matrix for sampling error assuming 0.5 correlation

mod_np2 <- rma.mv(yi, V = vi,
                  random = list(
                    ~1|species,
                    #~1|phylogeny,
                    ~1|pairID),
                  #R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_np2)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 33.1650  -66.3300  -60.3300  -52.7975  -60.0542   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2.1  0.0101  0.1006     46     no  species 
sigma^2.2  0.0101  0.1006     46     no   pairID 

Test for Heterogeneity:
Q(df = 91) = 303.2831, p-val < .0001

Model Results:

estimate      se    tval  df    pval   ci.lb   ci.ub      
  0.1162  0.0238  4.8887  91  <.0001  0.0690  0.1634  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_np2), 5)
  I2_Total I2_species  I2_pairID 
  71.77229   35.88614   35.88614 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_np2, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
mod_np3 <- rma.mv(yi, V = vi,
                  mod = ~ pre_post - 1,
                  random = list(
                    ~1|species,
                   # ~1|phylogeny,
                    ~1|pairID),
                  #R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_np3)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 35.6633  -71.3267  -63.3267  -53.3274  -62.8561   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2.1  0.0103  0.1014     46     no  species 
sigma^2.2  0.0103  0.1014     46     no   pairID 

Test for Residual Heterogeneity:
QE(df = 90) = 300.4417, p-val < .0001

Test of Moderators (coefficients 1:2):
F(df1 = 2, df2 = 90) = 15.7728, p-val < .0001

Model Results:

              estimate      se    tval  df    pval   ci.lb   ci.ub      
pre_postpost    0.0895  0.0257  3.4761  90  0.0008  0.0383  0.1406  *** 
pre_postpre     0.1437  0.0258  5.5636  90  <.0001  0.0924  0.1950  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(r2_ml(mod_np3), 5)
    R2_marginal R2_conditional1 R2_conditional2 
        0.03494         0.51747         0.51747 
Code
mod_np3b <- rma.mv(yi, V = vi,
                  mod = ~ pre_post,
                  random = list(
                    ~1|species,
                  #  ~1|phylogeny,
                    ~1|pairID),
                  #R = list(phylogeny = cor_tree),
                  data = dat_long,
                  test = "t",
                  sparse = TRUE)
summary(mod_np3b)

Multivariate Meta-Analysis Model (k = 92; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 35.6633  -71.3267  -63.3267  -53.3274  -62.8561   

Variance Components:

            estim    sqrt  nlvls  fixed   factor 
sigma^2.1  0.0103  0.1014     46     no  species 
sigma^2.2  0.0103  0.1014     46     no   pairID 

Test for Residual Heterogeneity:
QE(df = 90) = 300.4417, p-val < .0001

Test of Moderators (coefficient 2):
F(df1 = 1, df2 = 90) = 7.9244, p-val = 0.0060

Model Results:

             estimate      se    tval  df    pval   ci.lb   ci.ub      
intrcpt        0.0895  0.0257  3.4761  90  0.0008  0.0383  0.1406  *** 
pre_postpre    0.0543  0.0193  2.8150  90  0.0060  0.0160  0.0925   ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_np3, mod = "pre_post", xlab = "lnRR (all)", group = "species", g = FALSE)

24 Extra analysis

This extra analysis compares the impact of group living and testes mass on the lifespan extension.

24.1 Loading data and effect size calculation

Code
# loading data
dat0 <- read.csv(here("data", "zoo", "extra.csv"), na = c("", "NA"))

load(here("Rdata", "zoo", "maxCredTreeMammals.RData"))

tree <- maxCred #read.tree(here("data", "zoo", "tree_zoo.tre"))

# taxonomy
tax <- read.csv(here("data", "zoo", "species_merge_list.csv"))

dat0 %>% left_join(tax, by = c("Species" = "ZIMSSpecies")) -> dat_full

# talking out species with no data (Pseudocheirus peregrinus = likely to be mistaks in data)
# dat_full %>% filter(Species != "Chrysocyon brachyurus" &
#                     Species != "Crocuta crocuta" &
#                     Species != "Neofelis nebulosa" &
#                     Species != "Panthera uncia" &
#                     Species != "Pseudocheirus peregrinus") %>% 
#   mutate(phylogeny = gsub(" ", "_", vertlife.species)) -> dat

dat_full %>% 
  mutate(phylogeny = gsub(" ", "_", vertlife.treename)) -> dat

# take out NA which at Species column

dat <- dat[!is.na(dat$Species),]

# take out or filter out Macaca leonina (Species)

dat <- dat[dat$Species != "Macaca leonina", ]

# life span data 
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% unique(dat$phylogeny)))]

tree <- drop.tip(tree, to_drop)

# checking the number of spp
#length(tree$tip.label)

tree <- as.ultrametric(tree)

#tree <- compute.brlen(tree)
cor_tree <- vcv(tree, corr = TRUE)


missing <- which(is.na(dat$phylogeny))

dat$Species[missing]
character(0)
Code
# creating effect size 

dat <- escalc("ROM", 
              m1i = LifeExpContra,
              m2i = LifeExpNoContra,
              sd1i = SEcontra*sqrt(Ncontra),
              sd2i = SEnoContra*sqrt(NnoContra), 
              n1i = Ncontra,
              n2i = NnoContra,
              data = dat,
)

25 Meta-analysis and meta-regression

Code
mod_extra <- rma.mv(yi, V = vi,
                 random = list(
                   ~1|species,
                   ~1|phylogeny),
                 R = list(phylogeny = cor_tree),
                 test = "t",
                 data = dat)
summary(mod_extra)

Multivariate Meta-Analysis Model (k = 75; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 27.0989  -54.1977  -48.1977  -41.2855  -47.8549   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0157  0.1252     75     no    species   no 
sigma^2.2  0.0039  0.0625     75     no  phylogeny  yes 

Test for Heterogeneity:
Q(df = 74) = 260.6402, p-val < .0001

Model Results:

estimate      se    tval  df    pval    ci.lb   ci.ub    
  0.0839  0.0450  1.8650  74  0.0661  -0.0057  0.1736  . 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
round(i2_ml(mod_extra), 2)
    I2_Total   I2_species I2_phylogeny 
       75.46        60.40        15.06 
Code
#robust(mod_all, cluster = species)  

orchard_plot(mod_extra, xlab = "lnRR (all)", group = "species", g = FALSE)

Code
# fitting 2 moderators
mod_extra1 <- rma.mv(yi, V = vi,
                    mod = ~ Group.living - 1,
                    random = list(
                      ~1|species,
                      ~1|phylogeny),
                    R = list(phylogeny = cor_tree),
                    data = dat)
summary(mod_extra1)

Multivariate Meta-Analysis Model (k = 75; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 26.3804  -52.7607  -44.7607  -35.5989  -44.1725   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0162  0.1271     75     no    species   no 
sigma^2.2  0.0033  0.0577     75     no  phylogeny  yes 

Test for Residual Heterogeneity:
QE(df = 73) = 259.5542, p-val < .0001

Test of Moderators (coefficients 1:2):
QM(df = 2) = 4.2568, p-val = 0.1190

Model Results:

                 estimate      se    zval    pval    ci.lb   ci.ub    
Group.livingNo     0.0717  0.0493  1.4548  0.1457  -0.0249  0.1683    
Group.livingYes    0.0935  0.0455  2.0523  0.0401   0.0042  0.1827  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
orchard_plot(mod_extra1, xlab = "lnRR (all)", mod = "Group.living", group = "species", g = FALSE)

Code
dat$lnbodymass <- log(dat$Bodymass)
dat$lntestemass <-log(dat$Testesmass)

mod_extra2 <- rma.mv(yi, V = vi,
                     mod = ~  lntestemass + lnbodymass,
                     random = list(
                       ~1|species,
                       ~1|phylogeny),
                     R = list(phylogeny = cor_tree),
                     data = dat)
summary(mod_extra2)

Multivariate Meta-Analysis Model (k = 59; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
 28.5773  -57.1547  -47.1547  -37.0279  -45.9547   

Variance Components:

            estim    sqrt  nlvls  fixed     factor    R 
sigma^2.1  0.0114  0.1067     59     no    species   no 
sigma^2.2  0.0000  0.0000     59     no  phylogeny  yes 

Test for Residual Heterogeneity:
QE(df = 56) = 159.9245, p-val < .0001

Test of Moderators (coefficients 2:3):
QM(df = 2) = 1.8152, p-val = 0.4035

Model Results:

             estimate      se     zval    pval    ci.lb   ci.ub    
intrcpt        0.1689  0.0953   1.7720  0.0764  -0.0179  0.3558  . 
lntestemass    0.0261  0.0194   1.3468  0.1781  -0.0119  0.0641    
lnbodymass    -0.0164  0.0146  -1.1228  0.2615  -0.0450  0.0122    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
bubble_plot(mod_extra2, xlab = "log(Teste mass)", mod = "lntestemass", group = "species", g = FALSE)

26 PART IV: ANALYSIS OF CAUSES OF DEATH ON ZOO DATA

26.1 Loading data

Code
# main data
dat0 <- read_csv(here("data", "zoo2", "causeDeathAll.csv"), na = c("", "NA"))

# turning character strings into factors
dat0 <- dat0 %>% mutate(across(where(is.character), as.factor))

# length(unique(dat0$Species)) # the number of species 131

# phylogeny
tree <- read.tree(here("data", "zoo", "tree_zoo.tre"))

# taxonomy
tax <- read.csv(here("data", "zoo", "vertlife_taxonomy_translation_table.csv"))

# there are missing species in the taxonomy table
dat0 %>% left_join(tax, by = c("Species" = "zims.species")) %>% 
  # make character strings into factors
  mutate(across(where(is.character), as.factor)) -> dat_full

dat <- dat_full


dat$Phylogeny <- gsub(" ", "_", dat$vertlife.species)

#life span data
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% unique(dat$Phylogeny)))]

tree <- drop.tip(tree, to_drop)

# checking the number of spp
#length(tree$tip.label)

tree <- compute.brlen(tree)

#tree <- compute.brlen(tree)
cor_tree <- vcv(tree, corr = TRUE)


# samller data set which does not have NA in dat$Phylogeny

dat <- dat %>% filter(!is.na(Phylogeny))

# Effect_ID is the unique identifier for the effect

dat$Effect_ID <- factor(1:nrow(dat))


# creating a variable combining Sex and Type
dat$Sex_Type <- as.factor(paste0(dat$Sex, "_", dat$Type))

26.2 Meta-analysis of risk difference

Code
#########
# Behavioural
#########

# adding 0.5 for N = 0
#dat$Contra_Behavioural_N[dat$Contra_Behavioural_N == 0] <- 0.5
#dat$noContra_Behavioural_N[dat$noContra_Behavioural_N == 0] <- 0.5

# Low
dat_behavioural <- escalc(measure = "RD", 
               ai = Contra_Behavioural_Low*Contra_Behavioural_N, 
               bi = (1-Contra_Behavioural_Low)*Contra_Behavioural_N, 
               ci = noContra_Behavioural_Low*noContra_Behavioural_N,
               di = (1-noContra_Behavioural_Low)*noContra_Behavioural_N,
               var.names = c("yi_behavioural_low", "vi_behavioural_low"),
               data = dat)
# Med

dat_behavioural <- escalc(measure = "RD", 
               ai = Contra_Behavioural_Med*Contra_Behavioural_N, 
               bi = (1-Contra_Behavioural_Med)*Contra_Behavioural_N, 
               ci = noContra_Behavioural_Med*noContra_Behavioural_N,
               di = (1-noContra_Behavioural_Med)*noContra_Behavioural_N,
               var.names = c("yi_behavioural_med", "vi_behavioural_med"),
               data = dat_behavioural)

# Upp

dat_behavioural <- escalc(measure = "RD", 
               ai = Contra_Behavioural_Upp*Contra_Behavioural_N, 
               bi = (1-Contra_Behavioural_Upp)*Contra_Behavioural_N, 
               ci = noContra_Behavioural_Upp*noContra_Behavioural_N,
               di = (1-noContra_Behavioural_Upp)*noContra_Behavioural_N,
               var.names = c("yi_behavioural_upp", "vi_behavioural_upp"),
               data = dat_behavioural)

dat_behavioural %>% filter(Contra_Behavioural_N > 0) %>% filter(noContra_Behavioural_N > 0) -> dat_behavioural

# create a long format of the data  using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_behavioural <- dat_behavioural %>% select(Effect_ID, Species, Phylogeny, Sex_Type, Sex,
                           yi_behavioural_low, vi_behavioural_low, 
                           yi_behavioural_med, vi_behavioural_med, 
                           yi_behavioural_upp, vi_behavioural_upp) %>% 
  pivot_longer(cols = c(yi_behavioural_low, yi_behavioural_med, yi_behavioural_upp, vi_behavioural_low, vi_behavioural_med, vi_behavioural_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_behavioural <- dat_long_behavioural %>% filter(!is.na(yi))

str(dat_long_behavioural)
tibble [201 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 2 2 2 3 3 3 6 6 6 7 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 1 1 1 2 2 2 4 4 4 5 ...
 $ Phylogeny: chr [1:201] "Addax_nasomaculatus" "Addax_nasomaculatus" "Addax_nasomaculatus" "Aepyceros_melampus" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 4 4 4 4 4 4 4 4 4 4 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 2 2 2 2 ...
 $ type     : chr [1:201] "behavioural_low" "behavioural_med" "behavioural_upp" "behavioural_low" ...
 $ yi       : num [1:201] -0.0118 -0.2489 -0.228 -0.0691 -0.2465 ...
 $ vi       : num [1:201] 0.02777 0.04229 0.05688 0.00952 0.01555 ...
Code
dat_long_behavioural$type <- factor(dat_long_behavioural$type, levels = rev(c("behavioural_low", "behavioural_med", "behavioural_upp")),
                        labels = rev(c("Lower", "Median", "Upper")))

# effect size level ID

dat_long_behavioural$Effect_ID2 <- factor(1 : nrow(dat_long_behavioural))


# VCV

VCV <- vcalc(dat_long_behavioural$vi, 
            cluster = dat_long_behavioural$Effect_ID, 
            obs = dat_long_behavioural$Effect_ID2, 
            data = dat_long_behavioural, rho = 0.5)


# meta-analysis using dat_long

mod_behavioural <- rma.mv(yi = yi, V = VCV, 
                     random = list(
                       ~1|Species,
                       ~1|Phylogeny,
                       #~1|Effect_ID, 
                       ~1|Effect_ID2),
                     R = list(Phylogeny = cor_tree), 
                     data = dat_long_behavioural,
                     method="REML", 
                     sparse=TRUE,
                     control=list(optimizer="optim", optmethod="Nelder-Mead")
)


summary(mod_behavioural)

Multivariate Meta-Analysis Model (k = 201; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  93.8448  -187.6896  -179.6896  -166.4963  -179.4845   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     51     no     Species   no 
sigma^2.2  0.0000  0.0000     51     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    201     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 200) = 77.4901, p-val = 1.0000

Model Results:

estimate      se     zval    pval    ci.lb    ci.ub      
 -0.0567  0.0167  -3.3994  0.0007  -0.0893  -0.0240  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_behavioural_reg <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         #struct = "DIAG",
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_behavioural,
                         method="REML", 
                         control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                         mods = ~ type - 1,
                         sparse=TRUE
)

summary(mod_behavioural_reg)

Multivariate Meta-Analysis Model (k = 201; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  95.1552  -190.3104  -178.3104  -158.5808  -177.8706   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     51     no     Species   no 
sigma^2.2  0.0006  0.0241     51     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    201     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 198) = 71.0004, p-val = 1.0000

Test of Moderators (coefficients 1:3):
QM(df = 3) = 12.2076, p-val = 0.0067

Model Results:

            estimate      se     zval    pval    ci.lb    ci.ub     
typeUpper    -0.1011  0.0313  -3.2250  0.0013  -0.1625  -0.0396  ** 
typeMedian   -0.0779  0.0284  -2.7404  0.0061  -0.1336  -0.0222  ** 
typeLower    -0.0387  0.0231  -1.6770  0.0935  -0.0840   0.0065   . 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_behavioural <- orchard_plot(mod_behavioural_reg, mod = "type",
    xlab = "Risk difference (Behavioural)", group = "Species") + ylim(-0.7, 0.7)


p_behavioural

Code
# sex_type 

dat_long_behavioural$sex_type <-  as.factor(paste0(dat_long_behavioural$Sex, "_", dat_long_behavioural$type))

mod_behavioural_reg2 <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         #struct = "DIAG",
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_behavioural,
                         method="REML", 
                         control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                         mods = ~ sex_type - 1,
                         sparse=TRUE
)

summary(mod_behavioural_reg2)

Multivariate Meta-Analysis Model (k = 201; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  94.5082  -189.0165  -171.0165  -141.5595  -170.0435   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     51     no     Species   no 
sigma^2.2  0.0008  0.0290     51     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    201     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 195) = 67.3577, p-val = 1.0000

Test of Moderators (coefficients 1:6):
QM(df = 6) = 14.8120, p-val = 0.0218

Model Results:

                       estimate      se     zval    pval    ci.lb    ci.ub     
sex_typeFemale_Lower    -0.0514  0.0353  -1.4580  0.1448  -0.1205   0.0177     
sex_typeFemale_Median   -0.0570  0.0437  -1.3054  0.1918  -0.1426   0.0286     
sex_typeFemale_Upper    -0.0562  0.0482  -1.1655  0.2438  -0.1506   0.0383     
sex_typeMale_Lower      -0.0295  0.0292  -1.0091  0.3129  -0.0867   0.0278     
sex_typeMale_Median     -0.0895  0.0362  -2.4741  0.0134  -0.1603  -0.0186   * 
sex_typeMale_Upper      -0.1284  0.0401  -3.2019  0.0014  -0.2070  -0.0498  ** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_behavioural2 <- orchard_plot(mod_behavioural_reg2, mod = "sex_type",
                         xlab = "Risk difference \n(Behavioural)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_behavioural2

Code
# mod_table
res_behavioural <- mod_results(mod_behavioural_reg2,  mod = "sex_type", group = "Species")

attr(res_behavioural, "class") <- NULL

res_behavioural$mod_table$name <- paste( res_behavioural$mod_table$name, "Behavioural", sep = "_")
res_behavioural$mod_table$name <- factor(res_behavioural$mod_table$name)
res_behavioural$data$moderator <- paste( res_behavioural$data$moderator, "Behavioural", sep = "_")
res_behavioural$data$moderator <- factor(res_behavioural$data$moderator)
Code
####################
# Infectious Disease
####################

# adding 0.5 for N = 0

#dat$Contra_InfectDisease_N[dat$Contra_InfectDisease_N == 0] <- 0.5
#dat$noContra_InfectDisease_N[dat$noContra_InfectDisease_N == 0] <- 0.5

# Low

dat_infectious <- escalc(measure = "RD", 
               ai = Contra_InfectDisease_Low*Contra_InfectDisease_N,
               bi = (1-Contra_InfectDisease_Low)*Contra_InfectDisease_N,
               ci = noContra_InfectDisease_Low*noContra_InfectDisease_N,
               di = (1-noContra_InfectDisease_Low)*noContra_InfectDisease_N,
               var.names = c("yi_infectious_low", "vi_infectious_low"),
               data = dat)

# Med

dat_infectious <- escalc(measure = "RD",
               ai = Contra_InfectDisease_Med*Contra_InfectDisease_N, 
               bi = (1-Contra_InfectDisease_Med)*Contra_InfectDisease_N, 
               ci = noContra_InfectDisease_Med*noContra_InfectDisease_N,
               di = (1-noContra_InfectDisease_Med)*noContra_InfectDisease_N,
               var.names = c("yi_infectious_med", "vi_infectious_med"),
               data = dat_infectious)

# Upp

dat_infectious <- escalc(measure = "RD",
               ai = Contra_InfectDisease_Upp*Contra_InfectDisease_N, 
               bi = (1-Contra_InfectDisease_Upp)*Contra_InfectDisease_N, 
               ci = noContra_InfectDisease_Upp*noContra_InfectDisease_N,
               di = (1-noContra_InfectDisease_Upp)*noContra_InfectDisease_N,
               var.names = c("yi_infectious_upp", "vi_infectious_upp"),
               data = dat_infectious)

dat_infectious %>% filter(Contra_InfectDisease_N > 0) %>%  filter(noContra_InfectDisease_N > 0) -> dat_infectious


# create a long format of the data using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_infectious <- dat_infectious %>% select(Effect_ID, Species, Phylogeny, Sex_Type, Sex,
                           yi_infectious_low, vi_infectious_low, 
                           yi_infectious_med, vi_infectious_med, 
                           yi_infectious_upp, vi_infectious_upp) %>% 
  pivot_longer(cols = c(yi_infectious_low, yi_infectious_med, yi_infectious_upp, vi_infectious_low, vi_infectious_med, vi_infectious_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_infectious <- dat_long_infectious %>% filter(!is.na(yi))

str(dat_long_infectious)
tibble [222 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 2 2 2 3 3 3 4 4 4 7 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 1 1 1 2 2 2 3 3 3 5 ...
 $ Phylogeny: chr [1:222] "Addax_nasomaculatus" "Addax_nasomaculatus" "Addax_nasomaculatus" "Aepyceros_melampus" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 4 4 4 4 4 4 1 1 1 4 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 1 1 1 2 ...
 $ type     : chr [1:222] "infectious_low" "infectious_med" "infectious_upp" "infectious_low" ...
 $ yi       : num [1:222] 0.0846 -0.0439 -0.04 0.0482 0.0101 ...
 $ vi       : num [1:222] 0.0513 0.0574 0.093 0.0104 0.0168 ...
Code
dat_long_infectious$type <- factor(dat_long_infectious$type, 
                           levels = rev(c("infectious_low", "infectious_med", "infectious_upp")),
                           labels = rev(c("Lower", "Median", "Upper"))
)

# effect size level ID

dat_long_infectious$Effect_ID2 <- factor(1 : nrow(dat_long_infectious))

# VCV

VCV <- vcalc(dat_long_infectious$vi, 
            cluster = dat_long_infectious$Effect_ID, 
            obs = dat_long_infectious$Effect_ID2, 
            data = dat_long_infectious, rho = 0.5)


# meta-analysis using dat_long

mod_infectious <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_infectious,
                         test = "t",
                         method="REML", 
                         control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod_infectious)

Multivariate Meta-Analysis Model (k = 222; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
  98.3517  -196.7034  -188.7034  -175.1108  -188.5183   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     58     no     Species   no 
sigma^2.2  0.0000  0.0000     58     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    222     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 221) = 80.0166, p-val = 1.0000

Model Results:

estimate      se     tval   df    pval    ci.lb   ci.ub    
 -0.0021  0.0177  -0.1192  221  0.9052  -0.0370  0.0328    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_infectious_reg <- rma.mv(yi = yi, V = VCV, 
                             random = list(
                               ~1|Species,
                               ~1|Phylogeny,
                               ~1|Effect_ID2), 
                             #struct = "DIAG",
                             R = list(Phylogeny = cor_tree), 
                             data = dat_long_infectious,
                             method="REML", 
                             test = "t",
                             control=list(optimizer="optim", optmethod="Nelder-Mead"),
                             mods = ~type - 1,
                             sparse=TRUE
)

summary(mod_infectious_reg)

Multivariate Meta-Analysis Model (k = 222; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 104.3731  -208.7462  -196.7462  -176.4118  -196.3500   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     58     no     Species   no 
sigma^2.2  0.0000  0.0000     58     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    222     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 219) = 64.0554, p-val = 1.0000

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 219) = 5.3252, p-val = 0.0015

Model Results:

            estimate      se     tval   df    pval    ci.lb    ci.ub     
typeUpper    -0.0808  0.0281  -2.8713  219  0.0045  -0.1363  -0.0253  ** 
typeMedian   -0.0293  0.0235  -1.2444  219  0.2147  -0.0757   0.0171     
typeLower     0.0194  0.0191   1.0171  219  0.3102  -0.0182   0.0571     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_infectious <- orchard_plot(mod_infectious_reg, mod = "type",
    xlab = "Risk difference (Infectious Disease)", group = "Species") + ylim(-0.85, 0.7)

p_infectious

Code
# sex_type 

dat_long_infectious$sex_type <-  as.factor(paste0(dat_long_infectious$Sex, "_", dat_long_infectious$type))

mod_infectious_reg2 <- rma.mv(yi = yi, V = VCV, 
                          random = list(
                            ~1|Species,
                            ~1|Phylogeny,
                            ~1|Effect_ID2), 
                          #struct = "DIAG",
                          R = list(Phylogeny = cor_tree), 
                          data = dat_long_infectious,
                          method="REML", 
                          control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                          mods = ~ sex_type - 1,
                          sparse=TRUE
)

summary(mod_infectious_reg2)

Multivariate Meta-Analysis Model (k = 222; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 105.1417  -210.2834  -192.2834  -161.9059  -191.4096   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     58     no     Species   no 
sigma^2.2  0.0000  0.0000     58     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    222     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 216) = 57.8647, p-val = 1.0000

Test of Moderators (coefficients 1:6):
QM(df = 6) = 22.1661, p-val = 0.0011

Model Results:

                       estimate      se     zval    pval    ci.lb    ci.ub     
sex_typeFemale_Lower     0.0145  0.0317   0.4567  0.6479  -0.0477   0.0766     
sex_typeFemale_Median   -0.0861  0.0368  -2.3422  0.0192  -0.1581  -0.0140   * 
sex_typeFemale_Upper    -0.1344  0.0421  -3.1892  0.0014  -0.2170  -0.0518  ** 
sex_typeMale_Lower       0.0253  0.0240   1.0548  0.2915  -0.0217   0.0723     
sex_typeMale_Median      0.0124  0.0307   0.4053  0.6853  -0.0477   0.0726     
sex_typeMale_Upper      -0.0367  0.0379  -0.9688  0.3327  -0.1110   0.0376     

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_infectious2 <- orchard_plot(mod_infectious_reg2, mod = "sex_type",
                          xlab = "Risk difference \n(Infectious Disease)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_infectious2

Code
# mod_table
res_infectious <- mod_results(mod_infectious_reg2,  mod = "sex_type", group = "Species")

attr(res_infectious, "class") <- NULL

res_infectious$mod_table$name <- paste(res_infectious$mod_table$name, "Infectious", sep = "_")
res_infectious$mod_table$name <- factor(res_infectious$mod_table$name)
res_infectious$data$moderator <- paste(res_infectious$data$moderator, "Infectious", sep = "_")
res_infectious$data$moderator <- factor(res_infectious$data$moderator)
Code
########################
# Non-infectious Disease
########################

# adding 0.5 for N = 0

#dat$Contra_NonInfectDisease_N[dat$Contra_NonInfectDisease_N == 0] <- 0.5
#dat$noContra_NonInfectDisease_N[dat$noContra_NonInfectDisease_N == 0] <- 0.5

# Low

dat_noninfectious <- escalc(measure = "RD", 
               ai = Contra_NonInfectDisease_Low*Contra_NonInfectDisease_N,
               bi = (1-Contra_NonInfectDisease_Low)*Contra_NonInfectDisease_N,
               ci = noContra_NonInfectDisease_Low*noContra_NonInfectDisease_N,
               di = (1-noContra_NonInfectDisease_Low)*noContra_NonInfectDisease_N,
               var.names = c("yi_noninfectious_low", "vi_noninfectious_low"),
               data = dat)

# Med

dat_noninfectious <- escalc(measure = "RD",
               ai = Contra_NonInfectDisease_Med*Contra_NonInfectDisease_N, 
               bi = (1-Contra_NonInfectDisease_Med)*Contra_NonInfectDisease_N, 
               ci = noContra_NonInfectDisease_Med*noContra_NonInfectDisease_N,
               di = (1-noContra_NonInfectDisease_Med)*noContra_NonInfectDisease_N,
               var.names = c("yi_noninfectious_med", "vi_noninfectious_med"),
               data = dat_noninfectious)

# Upp

dat_noninfectious <- escalc(measure = "RD",
               ai = Contra_NonInfectDisease_Upp*Contra_NonInfectDisease_N, 
               bi = (1-Contra_NonInfectDisease_Upp)*Contra_NonInfectDisease_N, 
               ci = noContra_NonInfectDisease_Upp*noContra_NonInfectDisease_N,
               di = (1-noContra_NonInfectDisease_Upp)*noContra_NonInfectDisease_N,
               var.names = c("yi_noninfectious_upp", "vi_noninfectious_upp"),
               data = dat_noninfectious)

dat_noninfectious %>% filter(Contra_NonInfectDisease_N > 0) %>% filter(noContra_NonInfectDisease_N > 0) -> dat_noninfectious

# create a long format of the data using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_noninfectious <- dat_noninfectious %>% select(Effect_ID, Species, Phylogeny, Sex_Type, Sex,
                           yi_noninfectious_low, vi_noninfectious_low, 
                           yi_noninfectious_med, vi_noninfectious_med, 
                           yi_noninfectious_upp, vi_noninfectious_upp) %>% 
  pivot_longer(cols = c(yi_noninfectious_low, yi_noninfectious_med, yi_noninfectious_upp, vi_noninfectious_low, vi_noninfectious_med, vi_noninfectious_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_noninfectious <- dat_long_noninfectious %>% filter(!is.na(yi))

str(dat_long_noninfectious)
tibble [276 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 2 2 2 4 4 4 6 6 6 7 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 1 1 1 3 3 3 4 4 4 5 ...
 $ Phylogeny: chr [1:276] "Addax_nasomaculatus" "Addax_nasomaculatus" "Addax_nasomaculatus" "Alouatta_caraya" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 4 4 4 1 1 1 4 4 4 4 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 2 2 2 1 1 1 2 2 2 2 ...
 $ type     : chr [1:276] "noninfectious_low" "noninfectious_med" "noninfectious_upp" "noninfectious_low" ...
 $ yi       : num [1:276] 0.0694 0.0509 -0.0255 0.0773 0.0773 ...
 $ vi       : num [1:276] 0.0332 0.035 0.0352 0.1223 0.1223 ...
Code
dat_long_noninfectious$type <- factor(dat_long_noninfectious$type, 
                           levels = rev(c("noninfectious_low", "noninfectious_med", "noninfectious_upp")),
                           labels = rev(c("Lower", "Median", "Upper"))
                           )

# effect size level ID

dat_long_noninfectious$Effect_ID2 <- factor(1 : nrow(dat_long_noninfectious))

# VCV

VCV <- vcalc(dat_long_noninfectious$vi, 
            cluster = dat_long_noninfectious$Effect_ID, 
            obs = dat_long_noninfectious$Effect_ID2, 
            data = dat_long_noninfectious, rho = 0.5)

# meta-analysis using dat_long

mod_noninfectious <- rma.mv(yi = yi, V = VCV, 
                           random = list(
                             ~1|Species,
                             ~1|Phylogeny,
                             ~1|Effect_ID2), 
                           R = list(Phylogeny = cor_tree), 
                           data = dat_long_noninfectious,
                           method="REML", 
                           test = "t",
                           control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod_noninfectious)

Multivariate Meta-Analysis Model (k = 276; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 184.0053  -368.0107  -360.0107  -345.5436  -359.8625   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     67     no     Species   no 
sigma^2.2  0.0000  0.0000     67     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    276     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 275) = 135.6728, p-val = 1.0000

Model Results:

estimate      se    tval   df    pval    ci.lb   ci.ub    
  0.0059  0.0098  0.6013  275  0.5482  -0.0134  0.0251    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_noninfectious_reg <- rma.mv(yi = yi, V = VCV, 
                               random = list(
                                 ~1|Species,
                                 ~1|Phylogeny,
                                 ~1|Effect_ID2), 
                               #struct = "DIAG",
                               R = list(Phylogeny = cor_tree), 
                               data = dat_long_noninfectious,
                               method="REML", 
                               control=list(optimizer="optim", optmethod="Nelder-Mead"),
                               mods = ~type - 1,
                               test = "t",
                               sparse=TRUE
)

summary(mod_noninfectious_reg)

Multivariate Meta-Analysis Model (k = 276; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 183.4484  -366.8968  -354.8968  -333.2399  -354.5810   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     67     no     Species   no 
sigma^2.2  0.0000  0.0000     67     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    276     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 273) = 131.5937, p-val = 1.0000

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 273) = 1.4802, p-val = 0.2202

Model Results:

            estimate      se     tval   df    pval    ci.lb   ci.ub    
typeUpper    -0.0084  0.0205  -0.4086  273  0.6831  -0.0486  0.0319    
typeMedian   -0.0145  0.0142  -1.0232  273  0.3071  -0.0424  0.0134    
typeLower     0.0110  0.0102   1.0865  273  0.2782  -0.0090  0.0311    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_noninfectious <- orchard_plot(mod_noninfectious_reg, mod = "type",
    xlab = "Risk difference (Non-infectious Disease)", group = "Species") + ylim(-0.85, 0.7)

p_noninfectious

Code
# sex_type 

dat_long_noninfectious$sex_type <-  as.factor(paste0(dat_long_noninfectious$Sex, "_", dat_long_noninfectious$type))

mod_noninfectious_reg2 <- rma.mv(yi = yi, V = VCV, 
                              random = list(
                                ~1|Species,
                                ~1|Phylogeny,
                                ~1|Effect_ID2), 
                              #struct = "DIAG",
                              R = list(Phylogeny = cor_tree), 
                              data = dat_long_noninfectious,
                              method="REML", 
                              control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                              mods = ~ sex_type - 1,
                              sparse=TRUE
)

summary(mod_noninfectious_reg2)

Multivariate Meta-Analysis Model (k = 276; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 181.8799  -363.7597  -345.7597  -313.3739  -345.0674   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     67     no     Species   no 
sigma^2.2  0.0000  0.0000     67     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    276     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 270) = 127.7237, p-val = 1.0000

Test of Moderators (coefficients 1:6):
QM(df = 6) = 8.3106, p-val = 0.2162

Model Results:

                       estimate      se     zval    pval    ci.lb   ci.ub    
sex_typeFemale_Lower     0.0121  0.0150   0.8067  0.4198  -0.0174  0.0416    
sex_typeFemale_Median   -0.0364  0.0227  -1.6070  0.1080  -0.0808  0.0080    
sex_typeFemale_Upper    -0.0428  0.0309  -1.3857  0.1658  -0.1034  0.0178    
sex_typeMale_Lower       0.0094  0.0138   0.6795  0.4968  -0.0177  0.0364    
sex_typeMale_Median     -0.0007  0.0182  -0.0367  0.9707  -0.0363  0.0349    
sex_typeMale_Upper       0.0170  0.0273   0.6226  0.5336  -0.0365  0.0705    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_noninfectious2 <- orchard_plot(mod_noninfectious_reg2, mod = "sex_type",
                              xlab = "Risk difference \n(None-infectious Disease)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_noninfectious2

Code
# mod_table
res_noninfectious <- mod_results(mod_noninfectious_reg2,  mod = "sex_type", group = "Species")

attr(res_noninfectious, "class") <- NULL

res_noninfectious$mod_table$name <- paste(res_noninfectious$mod_table$name, "None-infectious", sep = "_")
res_noninfectious$mod_table$name <- factor(res_noninfectious$mod_table$name)
res_noninfectious$data$moderator <- paste(res_noninfectious$data$moderator, "None-infectious", sep = "_")
res_noninfectious$data$moderator <- factor(res_noninfectious$data$moderator)
Code
###################
# Chronic Disease
###################

# adding 0.5 for N = 0
#dat$Contra_ChronDisease_N[dat$Contra_ChronDisease_N == 0] <- 0.5
#dat$noContra_ChronDisease_N[dat$noContra_ChronDisease_N == 0] <- 0.5

# Low

dat_chronic <- escalc(measure = "RD", 
               ai = Contra_ChronDisease_Low*Contra_ChronDisease_N,
               bi = (1-Contra_ChronDisease_Low)*Contra_ChronDisease_N,
               ci = noContra_ChronDisease_Low*noContra_ChronDisease_N,
               di = (1-noContra_ChronDisease_Low)*noContra_ChronDisease_N,
               var.names = c("yi_chronic_low", "vi_chronic_low"),
               data = dat)

# Med

dat_chronic <- escalc(measure = "RD",
               ai = Contra_ChronDisease_Med*Contra_ChronDisease_N, 
               bi = (1-Contra_ChronDisease_Med)*Contra_ChronDisease_N, 
               ci = noContra_ChronDisease_Med*noContra_ChronDisease_N,
               di = (1-noContra_ChronDisease_Med)*noContra_ChronDisease_N,
               var.names = c("yi_chronic_med", "vi_chronic_med"),
               data = dat_chronic)

# Upp

dat_chronic <- escalc(measure = "RD",
               ai = Contra_ChronDisease_Upp*Contra_ChronDisease_N, 
               bi = (1-Contra_ChronDisease_Upp)*Contra_ChronDisease_N, 
               ci = noContra_ChronDisease_Upp*noContra_ChronDisease_N,
               di = (1-noContra_ChronDisease_Upp)*noContra_ChronDisease_N,
               var.names = c("yi_chronic_upp", "vi_chronic_upp"),
               data = dat_chronic)

dat_chronic %>% filter(Contra_ChronDisease_N > 0) %>% filter(noContra_ChronDisease_N > 0) -> dat_chronic

# create a long format of the data using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_chronic <- dat_chronic %>% select(Effect_ID, Species, Phylogeny, Sex_Type,Sex,
                           yi_chronic_low, vi_chronic_low, 
                           yi_chronic_med, vi_chronic_med, 
                           yi_chronic_upp, vi_chronic_upp) %>% 
  pivot_longer(cols = c(yi_chronic_low, yi_chronic_med, yi_chronic_upp, vi_chronic_low, vi_chronic_med, vi_chronic_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_chronic <- dat_long_chronic %>% filter(!is.na(yi))

str(dat_long_chronic)
tibble [231 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 2 2 2 4 4 4 6 6 6 7 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 1 1 1 3 3 3 4 4 4 5 ...
 $ Phylogeny: chr [1:231] "Addax_nasomaculatus" "Addax_nasomaculatus" "Addax_nasomaculatus" "Alouatta_caraya" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 4 4 4 1 1 1 4 4 4 4 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 2 2 2 1 1 1 2 2 2 2 ...
 $ type     : chr [1:231] "chronic_low" "chronic_med" "chronic_upp" "chronic_low" ...
 $ yi       : num [1:231] 0.15 0.1083 0.0529 -0.0833 0.0779 ...
 $ vi       : num [1:231] 0.112 0.118 0.143 0.14 0.208 ...
Code
dat_long_chronic$type <- factor(dat_long_chronic$type, 
                           levels = rev(c("chronic_low", "chronic_med", "chronic_upp")),
                           labels = rev(c("Lower", "Median", "Upper"))
                           )

# effect size level ID

dat_long_chronic$Effect_ID2 <- factor(1 : nrow(dat_long_chronic))

# VCV

VCV <- vcalc(dat_long_chronic$vi, 
            cluster = dat_long_chronic$Effect_ID, 
            obs = dat_long_chronic$Effect_ID2, 
            data = dat_long_chronic, rho = 0.5)

# meta-analysis using dat_long

mod_chronic <- rma.mv(yi = yi, V = VCV, 
                     random = list(
                       ~1|Species,
                       ~1|Phylogeny,
                       ~1|Effect_ID2), 
                     R = list(Phylogeny = cor_tree), 
                     data = dat_long_chronic,
                     method="REML", 
                     test = "t",
                     dfs = "contain",
                     control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod_chronic)

Multivariate Meta-Analysis Model (k = 231; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 115.5270  -231.0539  -223.0539  -209.3016  -222.8761   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     60     no     Species   no 
sigma^2.2  0.0000  0.0000     60     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    231     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 230) = 81.3545, p-val = 1.0000

Model Results:

estimate      se    tval  df    pval    ci.lb   ci.ub    
  0.0209  0.0159  1.3158  59  0.1933  -0.0109  0.0527    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_chronic_reg <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         struct = "DIAG",
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_chronic,
                         method="REML", 
                         control=list(optimizer="optim", optmethod="Nelder-Mead"),
                         mods = ~type - 1,
                         test = "t",
                         sparse=TRUE
)

summary(mod_chronic_reg)

Multivariate Meta-Analysis Model (k = 231; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 114.9271  -229.8541  -217.8541  -197.2781  -217.4740   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     60     no     Species   no 
sigma^2.2  0.0000  0.0000     60     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    231     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 228) = 78.2929, p-val = 1.0000

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 228) = 1.5977, p-val = 0.1907

Model Results:

            estimate      se    tval   df    pval    ci.lb   ci.ub    
typeUpper     0.0237  0.0267  0.8860  228  0.3765  -0.0290  0.0763    
typeMedian    0.0036  0.0187  0.1901  228  0.8494  -0.0333  0.0404    
typeLower     0.0367  0.0183  1.9993  228  0.0468   0.0005  0.0728  * 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_chronic <- orchard_plot(mod_chronic_reg, mod = "type",
    xlab = "Risk difference (Chronic Disease)", group = "Species") + ylim(-0.85, 0.7)

p_chronic

Code
# sex_type 

dat_long_chronic$sex_type <-  as.factor(paste0(dat_long_chronic$Sex, "_", dat_long_chronic$type))

mod_chronic_reg2 <- rma.mv(yi = yi, V = VCV, 
                                 random = list(
                                   ~1|Species,
                                   ~1|Phylogeny,
                                   ~1|Effect_ID2), 
                                 #struct = "DIAG",
                                 R = list(Phylogeny = cor_tree), 
                                 data = dat_long_chronic,
                                 method="REML", 
                                 control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                                 mods = ~ sex_type - 1,
                                 sparse=TRUE
)

summary(mod_chronic_reg2)

Multivariate Meta-Analysis Model (k = 231; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 112.3685  -224.7370  -206.7370  -175.9921  -205.8998   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000     60     no     Species   no 
sigma^2.2  0.0000  0.0000     60     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000    231     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 225) = 78.1638, p-val = 1.0000

Test of Moderators (coefficients 1:6):
QM(df = 6) = 4.9222, p-val = 0.5538

Model Results:

                       estimate      se     zval    pval    ci.lb   ci.ub    
sex_typeFemale_Lower     0.0332  0.0284   1.1711  0.2415  -0.0224  0.0888    
sex_typeFemale_Median   -0.0047  0.0301  -0.1546  0.8771  -0.0636  0.0543    
sex_typeFemale_Upper     0.0206  0.0434   0.4741  0.6354  -0.0644  0.1055    
sex_typeMale_Lower       0.0390  0.0241   1.6197  0.1053  -0.0082  0.0861    
sex_typeMale_Median      0.0088  0.0239   0.3668  0.7138  -0.0381  0.0556    
sex_typeMale_Upper       0.0256  0.0339   0.7539  0.4509  -0.0409  0.0920    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_chronic2 <- orchard_plot(mod_chronic_reg2, mod = "sex_type",
                                 xlab = "Risk difference \n(Chronic Disease)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_chronic2

Code
# mod_table
res_chronic <- mod_results(mod_chronic_reg2,  mod = "sex_type", group = "Species")

attr(res_chronic, "class") <- NULL

res_chronic$mod_table$name <- paste(res_chronic$mod_table$name, "Chronic", sep = "_")
res_chronic$mod_table$name <- factor(res_chronic$mod_table$name)
res_chronic$data$moderator <- paste(res_chronic$data$moderator, "Chronic", sep = "_")
res_chronic$data$moderator <- factor(res_chronic$data$moderator)
Code
###################
# Death at birth
###################

# adding 0.5 for N = 0
#dat$Contra_deathAtBirth_N[dat$Contra_deathAtBirth_N == 0] <- 0.5
#dat$noContra_deathAtBirth_N[dat$noContra_deathAtBirth_N == 0] <- 0.5

# Low

dat_deathAtBirth <- escalc(measure = "RD", 
               ai = Contra_deathAtBirth_Low*Contra_deathAtBirth_N,
               bi = (1-Contra_deathAtBirth_Low)*Contra_deathAtBirth_N,
               ci = noContra_deathAtBirth_Low*noContra_deathAtBirth_N,
               di = (1-noContra_deathAtBirth_Low)*noContra_deathAtBirth_N,
               var.names = c("yi_deathAtBirth_low", "vi_deathAtBirth_low"),
               data = dat)

# Med

dat_deathAtBirth <- escalc(measure = "RD",
               ai = Contra_deathAtBirth_Med*Contra_deathAtBirth_N, 
               bi = (1-Contra_deathAtBirth_Med)*Contra_deathAtBirth_N, 
               ci = noContra_deathAtBirth_Med*noContra_deathAtBirth_N,
               di = (1-noContra_deathAtBirth_Med)*noContra_deathAtBirth_N,
               var.names = c("yi_deathAtBirth_med", "vi_deathAtBirth_med"),
               data = dat_deathAtBirth)

# Upp

dat_deathAtBirth <- escalc(measure = "RD",
               ai = Contra_deathAtBirth_Upp*Contra_deathAtBirth_N, 
               bi = (1-Contra_deathAtBirth_Upp)*Contra_deathAtBirth_N, 
               ci = noContra_deathAtBirth_Upp*noContra_deathAtBirth_N,
               di = (1-noContra_deathAtBirth_Upp)*noContra_deathAtBirth_N,
               var.names = c("yi_deathAtBirth_upp", "vi_deathAtBirth_upp"),
               data = dat_deathAtBirth)

dat_deathAtBirth %>% filter(Contra_deathAtBirth_N > 0) %>%  filter(noContra_deathAtBirth_N > 0) -> dat_deathAtBirth


# create a long format of the data using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_deathAtBirth <- dat_deathAtBirth %>% select(Effect_ID, Species, Phylogeny, Sex_Type,Sex,
                           yi_deathAtBirth_low, vi_deathAtBirth_low, 
                           yi_deathAtBirth_med, vi_deathAtBirth_med, 
                           yi_deathAtBirth_upp, vi_deathAtBirth_upp) %>% 
  pivot_longer(cols = c(yi_deathAtBirth_low, yi_deathAtBirth_med, yi_deathAtBirth_upp, vi_deathAtBirth_low, vi_deathAtBirth_med, vi_deathAtBirth_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_deathAtBirth <- dat_long_deathAtBirth %>% filter(!is.na(yi))

str(dat_long_deathAtBirth)
tibble [18 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 17 17 17 19 19 19 67 67 67 129 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 14 14 14 16 16 16 53 53 53 95 ...
 $ Phylogeny: chr [1:18] "Callimico_goeldii" "Callimico_goeldii" "Callimico_goeldii" "Callithrix_jacchus" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 1 1 1 1 1 1 1 1 1 1 ...
 $ type     : chr [1:18] "deathAtBirth_low" "deathAtBirth_med" "deathAtBirth_upp" "deathAtBirth_low" ...
 $ yi       : num [1:18] 0.19385 0.070647 0.000914 0.209016 -0.001908 ...
 $ vi       : num [1:18] 0.0986 0.1476 0.1527 0.0964 0.0447 ...
Code
dat_long_deathAtBirth$type <- factor(dat_long_deathAtBirth$type, 
                           levels = rev(c("deathAtBirth_low", "deathAtBirth_med", "deathAtBirth_upp")),
                           labels = rev(c("Lower", "Median", "Upper"))
                           )

# effect size level ID

dat_long_deathAtBirth$Effect_ID2 <- factor(1 : nrow(dat_long_deathAtBirth))

# VCV

VCV <- vcalc(dat_long_deathAtBirth$vi, 
            cluster = dat_long_deathAtBirth$Effect_ID, 
            obs = dat_long_deathAtBirth$Effect_ID2, 
            data = dat_long_deathAtBirth, rho = 0.5)

# meta-analysis using dat_long

mod_deathAtBirth <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_deathAtBirth,
                         method="REML", 
                         test = "t",
                         control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod_deathAtBirth)

Multivariate Meta-Analysis Model (k = 18; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  3.9616   -7.9232    0.0768    3.4097    3.4101   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000      6     no     Species   no 
sigma^2.2  0.0000  0.0000      6     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000     18     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 17) = 2.6813, p-val = 1.0000

Model Results:

estimate      se     tval  df    pval    ci.lb   ci.ub    
 -0.0010  0.1008  -0.0099  17  0.9922  -0.2136  0.2116    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_deathAtBirth_reg <- rma.mv(yi = yi, V = VCV, 
                             random = list(
                               ~1|Species,
                               ~1|Phylogeny,
                               ~1|Effect_ID2), 
                             #struct = "DIAG",
                             R = list(Phylogeny = cor_tree), 
                             data = dat_long_deathAtBirth,
                             method="REML", 
                             control=list(optimizer="optim", optmethod="Nelder-Mead"),
                             mods = ~type - 1,
                             test = "t",
                             sparse=FALSE
)

summary(mod_deathAtBirth_reg)

Multivariate Meta-Analysis Model (k = 18; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  3.5523   -7.1045    4.8955    9.1438   15.3955   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000      6     no     Species   no 
sigma^2.2  0.0000  0.0000      6     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000     18     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 15) = 1.0871, p-val = 1.0000

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 15) = 0.5314, p-val = 0.6676

Model Results:

            estimate      se     tval  df    pval    ci.lb   ci.ub    
typeUpper    -0.0691  0.1246  -0.5548  15  0.5872  -0.3346  0.1964    
typeMedian   -0.0202  0.1235  -0.1633  15  0.8725  -0.2833  0.2430    
typeLower     0.0873  0.1249   0.6992  15  0.4952  -0.1788  0.3535    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_deathAtBirth <- orchard_plot(mod_deathAtBirth_reg, mod = "type",
    xlab = "Risk difference (Death at Birth)", group = "Species") + ylim(-0.85, 0.7)

p_deathAtBirth

Code
# sex_type 

dat_long_deathAtBirth$sex_type <-  as.factor(paste0(dat_long_deathAtBirth$Sex, "_", dat_long_deathAtBirth$type))

mod_deathAtBirth_reg2 <- rma.mv(yi = yi, V = VCV, 
                           random = list(
                             ~1|Species,
                             ~1|Phylogeny,
                             ~1|Effect_ID2), 
                           #struct = "DIAG",
                           R = list(Phylogeny = cor_tree), 
                           data = dat_long_deathAtBirth,
                           method="REML", 
                           control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                           mods = ~ sex_type - 1,
                           sparse=TRUE
)

summary(mod_deathAtBirth_reg2)

Multivariate Meta-Analysis Model (k = 18; method: REML)

  logLik  Deviance       AIC       BIC      AICc   
  3.5523   -7.1045    4.8955    9.1438   15.3955   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0000  0.0000      6     no     Species   no 
sigma^2.2  0.0000  0.0000      6     no   Phylogeny  yes 
sigma^2.3  0.0000  0.0000     18     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 15) = 1.0871, p-val = 1.0000

Test of Moderators (coefficients 1:3):
QM(df = 3) = 1.5943, p-val = 0.6607

Model Results:

                       estimate      se     zval    pval    ci.lb   ci.ub    
sex_typeFemale_Lower     0.0873  0.1249   0.6992  0.4845  -0.1574  0.3320    
sex_typeFemale_Median   -0.0202  0.1235  -0.1633  0.8703  -0.2622  0.2218    
sex_typeFemale_Upper    -0.0691  0.1246  -0.5548  0.5790  -0.3133  0.1750    

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# mod_table
res_deathAtBirth <- mod_results(mod_deathAtBirth_reg2,  mod = "sex_type", group = "Species")

attr(res_deathAtBirth, "class") <- NULL

res_deathAtBirth$mod_table$name <- paste(res_deathAtBirth$mod_table$name, "Death", sep = "_")
res_deathAtBirth$mod_table$name <- factor(res_deathAtBirth$mod_table$name)
res_deathAtBirth$data$moderator <- paste(res_deathAtBirth$data$moderator, "Death", sep = "_")
res_deathAtBirth$data$moderator <- factor(res_deathAtBirth$data$moderator)


p_deathAtBirth2 <- orchard_plot(mod_deathAtBirth_reg2, mod = "sex_type",
                           xlab = "Risk difference \n(Death at birth)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_deathAtBirth2

Code
########
# Other
########

# adding 0.5 for N = 0
#dat$Contra_Other_N[dat$Contra_Other_N == 0] <- 0.5
#dat$noContra_Other_N[dat$noContra_Other_N == 0] <- 0.5

# Low

dat_other <- escalc(measure = "RD", 
               ai = Contra_Other_Low*Contra_Other_N,
               bi = (1-Contra_Other_Low)*Contra_Other_N,
               ci = noContra_Other_Low*noContra_Other_N,
               di = (1-noContra_Other_Low)*noContra_Other_N,
               var.names = c("yi_other_low", "vi_other_low"),
               data = dat)

# Med

dat_other <- escalc(measure = "RD",
               ai = Contra_Other_Med*Contra_Other_N, 
               bi = (1-Contra_Other_Med)*Contra_Other_N, 
               ci = noContra_Other_Med*noContra_Other_N,
               di = (1-noContra_Other_Med)*noContra_Other_N,
               var.names = c("yi_other_med", "vi_other_med"),
               data = dat_other)

# Upp

dat_other <- escalc(measure = "RD",
               ai = Contra_Other_Upp*Contra_Other_N, 
               bi = (1-Contra_Other_Upp)*Contra_Other_N, 
               ci = noContra_Other_Upp*noContra_Other_N,
               di = (1-noContra_Other_Upp)*noContra_Other_N,
               var.names = c("yi_other_upp", "vi_other_upp"),
               data = dat_other)

dat_other %>% filter(Contra_Other_N > 0) %>% filter(noContra_Other_N > 0) -> dat_other

# create a long format of the data using these 3 types of effect sizes (low, med, upp) yi and vi are the effect size and variance of the effect size

dat_long_other <- dat_other %>% select(Effect_ID, Species, Phylogeny, Sex_Type,Sex,
                           yi_other_low, vi_other_low, 
                           yi_other_med, vi_other_med, 
                           yi_other_upp, vi_other_upp) %>% 
  pivot_longer(cols = c(yi_other_low, yi_other_med, yi_other_upp, vi_other_low, vi_other_med, vi_other_upp), 
               names_to = c(".value", "type"), 
               names_pattern = "(yi|vi)_(.*)")

dat_long_other <- dat_long_other %>% filter(!is.na(yi))

str(dat_long_other)
tibble [291 × 8] (S3: tbl_df/tbl/data.frame)
 $ Effect_ID: Factor w/ 184 levels "1","2","3","4",..: 2 2 2 3 3 3 4 4 4 6 ...
 $ Species  : Factor w/ 131 levels "Addax nasomaculatus",..: 1 1 1 2 2 2 3 3 3 4 ...
 $ Phylogeny: chr [1:291] "Addax_nasomaculatus" "Addax_nasomaculatus" "Addax_nasomaculatus" "Aepyceros_melampus" ...
 $ Sex_Type : Factor w/ 4 levels "Female_Hormonal",..: 4 4 4 4 4 4 1 1 1 4 ...
 $ Sex      : Factor w/ 2 levels "Female","Male": 2 2 2 2 2 2 1 1 1 2 ...
 $ type     : chr [1:291] "other_low" "other_med" "other_upp" "other_low" ...
 $ yi       : num [1:291] -0.322 -0.454 -0.277 -0.176 -0.418 ...
 $ vi       : num [1:291] 0.01039 0.01734 0.01927 0.00323 0.0051 ...
Code
dat_long_other$type <- factor(dat_long_other$type, 
                           levels = rev(c("other_low", "other_med", "other_upp")),
                           labels = rev(c("Lower", "Median", "Upper"))
                           )
# effect size level ID  

dat_long_other$Effect_ID2 <- factor(1 : nrow(dat_long_other))

# VCV

VCV <- vcalc(dat_long_other$vi, 
            cluster = dat_long_other$Effect_ID, 
            obs = dat_long_other$Effect_ID2, 
            data = dat_long_other, rho = 0.5)


# meta-analysis using dat_long

mod_other <- rma.mv(yi = yi, V = VCV, 
                     random = list(
                       ~1|Species,
                       ~1|Phylogeny,
                       ~1|Effect_ID2), 
                     R = list(Phylogeny = cor_tree), 
                     data = dat_long_other,
                     method="REML", 
                     test = "t",
                     control=list(optimizer="optim", optmethod="Nelder-Mead")
)

summary(mod_other)

Multivariate Meta-Analysis Model (k = 291; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 123.1042  -246.2084  -238.2084  -223.5289  -238.0681   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0047  0.0683     70     no     Species   no 
sigma^2.2  0.0015  0.0386     70     no   Phylogeny  yes 
sigma^2.3  0.0137  0.1170    291     no  Effect_ID2   no 

Test for Heterogeneity:
Q(df = 290) = 1802.6136, p-val < .0001

Model Results:

estimate      se     tval   df    pval    ci.lb    ci.ub      
 -0.2357  0.0250  -9.4262  290  <.0001  -0.2849  -0.1864  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
# meta-regression

mod_other_reg <- rma.mv(yi = yi, V = VCV, 
                         random = list(
                           ~1|Species,
                           ~1|Phylogeny,
                           ~1|Effect_ID2), 
                         #struct = "DIAG",
                         R = list(Phylogeny = cor_tree), 
                         data = dat_long_other,
                         method="REML", 
                         control=list(optimizer="optim", optmethod="Nelder-Mead"),
                         mods = ~type - 1,
                         test = "t",
                         sparse=FALSE
)

summary(mod_other_reg)

Multivariate Meta-Analysis Model (k = 291; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 143.0236  -286.0471  -274.0471  -252.0694  -273.7482   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0046  0.0676     70     no     Species   no 
sigma^2.2  0.0016  0.0400     70     no   Phylogeny  yes 
sigma^2.3  0.0099  0.0996    291     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 288) = 1132.1735, p-val < .0001

Test of Moderators (coefficients 1:3):
F(df1 = 3, df2 = 288) = 45.9173, p-val < .0001

Model Results:

            estimate      se      tval   df    pval    ci.lb    ci.ub      
typeUpper    -0.1715  0.0275   -6.2360  288  <.0001  -0.2256  -0.1174  *** 
typeMedian   -0.3049  0.0278  -10.9838  288  <.0001  -0.3595  -0.2503  *** 
typeLower    -0.2352  0.0268   -8.7890  288  <.0001  -0.2878  -0.1825  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_other <- orchard_plot(mod_other_reg, mod = "type",
    xlab = "Risk difference (Other)", group = "Species") + ylim(-0.85, 0.7)

p_other

Code
# sex_type 

dat_long_other$sex_type <-  as.factor(paste0(dat_long_other$Sex, "_", dat_long_other$type))

mod_other_reg2 <- rma.mv(yi = yi, V = VCV, 
                           random = list(
                             ~1|Species,
                             ~1|Phylogeny,
                             ~1|Effect_ID2), 
                           #struct = "DIAG",
                           R = list(Phylogeny = cor_tree), 
                           data = dat_long_other,
                           method="REML", 
                           control=list(optimizer="optim", optmethod= "Nelder-Mead"),
                           mods = ~ sex_type - 1,
                           sparse=TRUE
)

summary(mod_other_reg2)

Multivariate Meta-Analysis Model (k = 291; method: REML)

   logLik   Deviance        AIC        BIC       AICc   
 140.6424  -281.2847  -263.2847  -230.4123  -262.6302   

Variance Components:

            estim    sqrt  nlvls  fixed      factor    R 
sigma^2.1  0.0040  0.0636     70     no     Species   no 
sigma^2.2  0.0025  0.0496     70     no   Phylogeny  yes 
sigma^2.3  0.0101  0.1004    291     no  Effect_ID2   no 

Test for Residual Heterogeneity:
QE(df = 285) = 1118.7993, p-val < .0001

Test of Moderators (coefficients 1:6):
QM(df = 6) = 117.0718, p-val < .0001

Model Results:

                       estimate      se     zval    pval    ci.lb    ci.ub      
sex_typeFemale_Lower    -0.2501  0.0361  -6.9347  <.0001  -0.3208  -0.1794  *** 
sex_typeFemale_Median   -0.3205  0.0385  -8.3347  <.0001  -0.3959  -0.2451  *** 
sex_typeFemale_Upper    -0.1956  0.0380  -5.1409  <.0001  -0.2701  -0.1210  *** 
sex_typeMale_Lower      -0.2296  0.0325  -7.0561  <.0001  -0.2934  -0.1658  *** 
sex_typeMale_Median     -0.2991  0.0337  -8.8713  <.0001  -0.3652  -0.2330  *** 
sex_typeMale_Upper      -0.1607  0.0333  -4.8299  <.0001  -0.2259  -0.0955  *** 

---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
p_other2 <- orchard_plot(mod_other_reg2, mod = "sex_type",
                           xlab = "Risk difference \n(Other causes)", group = "Species", flip = F) + ylim(-0.85, 0.7)


p_other2

26.3 Figure code

Code
# mod_table
res_other <- mod_results(mod_other_reg2,  mod = "sex_type", group = "Species")

attr(res_other, "class") <- NULL

res_other$mod_table$name <- paste(res_other$mod_table$name, "Other", sep = "_")
res_other$mod_table$name <- factor(res_other$mod_table$name)
res_other$data$moderator <- paste(res_other$data$moderator, "Other", sep = "_")
res_other$data$moderator <- factor(res_other$data$moderator)

# combining all plots - use cowplot

p_all <- plot_grid(p_behavioural, 
                   p_infectious, 
                   p_noninfectious, 
                   p_chronic, 
                   p_deathAtBirth, 
                   p_other,
                   ncol = 2)

p_all

p_all2 <- plot_grid(p_behavioural2, 
                   p_infectious2, 
                   p_noninfectious2, 
                   p_chronic2, 
                   #p_deathAtBirth, 
                   p_other2,
                   ncol = 2)

p_all2

# using patchwork

design <- "AAAA
           BBBB
           CCCC
           DDDD
           EE##
           FFFF"


p_behavioural2 + p_infectious2 + p_noninfectious2 + p_chronic2 + p_deathAtBirth2 + p_other2 +
  plot_layout(design = design) + plot_annotation(title = "Risk Difference (RD) for different causes of death")


##############
# figures 
# lower female
##################

mod_table_lower_f <- rbind(res_other$mod_table[1, ],
                           res_deathAtBirth$mod_table[1, ],
                           res_chronic$mod_table[1, ],
                           res_noninfectious$mod_table[1, ],
                           res_infectious$mod_table[1, ],
                           res_behavioural$mod_table[1, ]
                           )

data_lower_f <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Female_Lower_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Female_Lower_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Female_Lower_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Female_Lower_Chronic", ],
                      res_deathAtBirth$data[res_deathAtBirth$data$moderator == "Female_Lower_Death", ],
                      res_other$data[res_other$data$moderator == "Female_Lower_Other", ])

mod_table_lower_f$name <- gsub("Female_Lower_", "", mod_table_lower_f$name)
mod_table_lower_f$name <- factor(mod_table_lower_f$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                              labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                         "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )
data_lower_f$moderator <- gsub("Female_Lower_", "", data_lower_f$moderator)
data_lower_f$moderator <- factor(data_lower_f$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                              labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                         "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )

res_lower_f <- list(mod_table = mod_table_lower_f, data = data_lower_f)

class(res_lower_f) <-  c("orchard", "data.frame")

p_lower_f <- orchard_plot(res_lower_f, mod = "sex_type",
            xlab = "Risk difference (Lower)", group = "Species", angle = 0) + ylim(-0.85, 0.7) + labs(title = "Female") + 
  theme(axis.title.x = element_blank(), axis.text.x  = element_blank(), axis.ticks.x = element_blank())
  #theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank())

# median female

mod_table_median_f <- rbind(res_other$mod_table[2, ],
                           res_deathAtBirth$mod_table[2, ],
                           res_chronic$mod_table[2, ],
                           res_noninfectious$mod_table[2, ],
                           res_infectious$mod_table[2, ],
                           res_behavioural$mod_table[2, ]
                           )

data_median_f <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Female_Median_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Female_Median_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Female_Median_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Female_Median_Chronic", ],
                      res_deathAtBirth$data[res_deathAtBirth$data$moderator == "Female_Median_Death", ],
                      res_other$data[res_other$data$moderator == "Female_Median_Other", ]
                      )

mod_table_median_f$name <- gsub("Female_Median_", "", mod_table_median_f$name)
mod_table_median_f$name <- factor(mod_table_median_f$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                              labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                         "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )
data_median_f$moderator <- gsub("Female_Median_", "", data_median_f$moderator)
data_median_f$moderator <- factor(data_median_f$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                              labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                         "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )

res_median_f <- list(mod_table = mod_table_median_f, data = data_median_f)

class(res_median_f) <-  c("orchard", "data.frame")

p_median_f <- orchard_plot(res_median_f, mod = "sex_type",
            xlab = "Risk difference (Median)", group = "Species", angle = 0) + ylim(-0.85, 0.7) + 
  theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank()) + 
  theme(axis.title.x = element_blank(), axis.text.x  = element_blank(), axis.ticks.x = element_blank())

# upper female

mod_table_upper_f <- rbind(res_other$mod_table[3, ],
                           res_deathAtBirth$mod_table[3, ],
                           res_chronic$mod_table[3, ],
                           res_noninfectious$mod_table[3, ],
                           res_infectious$mod_table[3, ],
                           res_behavioural$mod_table[3, ]
                           )

data_upper_f <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Female_Upper_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Female_Upper_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Female_Upper_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Female_Upper_Chronic", ],
                      res_deathAtBirth$data[res_deathAtBirth$data$moderator == "Female_Upper_Death", ],
                      res_other$data[res_other$data$moderator == "Female_Upper_Other", ]
                      ) 

mod_table_upper_f$name <- gsub("Female_Upper_", "", mod_table_upper_f$name)
mod_table_upper_f$name <- factor(mod_table_upper_f$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                                  labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                 "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )
data_upper_f$moderator <- gsub("Female_Upper_", "", data_upper_f$moderator)
data_upper_f$moderator <- factor(data_upper_f$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Death", "Other")), 
                                  labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                 "Chronic\ndisease", "Death\nat birth", "Other\ncauses")) )

res_upper_f <- list(mod_table = mod_table_upper_f, data = data_upper_f)

class(res_upper_f) <-  c("orchard", "data.frame")

p_upper_f <- orchard_plot(res_upper_f, mod = "sex_type",
                           xlab = "Risk difference (Upper)", group = "Species", angle = 0) + ylim(-0.85, 0.7) + 
  theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank()) + 
  theme(axis.title.x = element_blank(), axis.text.x  = element_blank(), axis.ticks.x = element_blank())

# lower male

mod_table_lower_m <- rbind(res_other$mod_table[4, ],
                           res_chronic$mod_table[4, ],
                           res_noninfectious$mod_table[4, ],
                           res_infectious$mod_table[4, ],
                           res_behavioural$mod_table[4, ]
                           )

mod_table_lower_m$name <- as.character(mod_table_lower_m$name)

data_lower_m <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Male_Lower_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Male_Lower_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Male_Lower_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Male_Lower_Chronic", ],
                      res_other$data[res_other$data$moderator == "Male_Lower_Other", ])

data_lower_m$moderator <- as.character(data_lower_m$moderator)

mod_table_lower_m$name <- gsub("Male_Lower_", "", mod_table_lower_m$name)
mod_table_lower_m$name <- factor(mod_table_lower_m$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic","Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )
data_lower_m$moderator <- gsub("Male_Lower_", "", data_lower_m$moderator)
data_lower_m$moderator <- factor(data_lower_m$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )

res_lower_m <- list(mod_table = mod_table_lower_m, data = data_lower_m)

class(res_lower_m) <-  c("orchard", "data.frame") 

p_lower_m <- orchard_plot(res_lower_m, mod = "sex_type",
                          xlab = "Risk difference (Lower)", group = "Species", angle = 0) + ylim(-0.85, 0.7) + labs(title = "Male") #+ 
 #theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank())


# median male

mod_table_median_m <- rbind(res_other$mod_table[5, ],
                           res_chronic$mod_table[5, ],
                           res_noninfectious$mod_table[5, ],
                           res_infectious$mod_table[5, ],
                           res_behavioural$mod_table[5, ]
                           )

mod_table_median_m$name <- as.character(mod_table_median_m$name)

data_median_m <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Male_Median_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Male_Median_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Male_Median_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Male_Median_Chronic", ],
                      res_other$data[res_other$data$moderator == "Male_Median_Other", ])

data_median_m$moderator <- as.character(data_median_m$moderator)

mod_table_median_m$name <- gsub("Male_Median_", "", mod_table_median_m$name)
mod_table_median_m$name <- factor(mod_table_median_m$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic","Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )
data_median_m$moderator <- gsub("Male_Median_", "", data_median_m$moderator)
data_median_m$moderator <- factor(data_median_m$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )

res_median_m <- list(mod_table = mod_table_median_m, data = data_median_m)

class(res_median_m) <-  c("orchard", "data.frame") 

p_median_m <- orchard_plot(res_median_m, mod = "sex_type",
                          xlab = "Risk difference (Median)", group = "Species", angle = 0) + ylim(-0.85, 0.7)  +
  theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank())
                                          
# upper male

mod_table_upper_m <- rbind(res_other$mod_table[6, ],
                           res_chronic$mod_table[6, ],
                           res_noninfectious$mod_table[6, ],
                           res_infectious$mod_table[6, ],
                           res_behavioural$mod_table[6, ]
                           )

mod_table_upper_m$name <- as.character(mod_table_upper_m$name)

data_upper_m <- rbind(res_behavioural$data[res_behavioural$data$moderator == "Male_Upper_Behavioural", ],
                      res_infectious$data[res_infectious$data$moderator == "Male_Upper_Infectious", ],
                      res_noninfectious$data[res_noninfectious$data$moderator == "Male_Upper_None-infectious", ],
                      res_chronic$data[res_chronic$data$moderator == "Male_Upper_Chronic", ],
                      res_other$data[res_other$data$moderator == "Male_Upper_Other", ])

data_upper_m$moderator <- as.character(data_upper_m$moderator)

mod_table_upper_m$name <- gsub("Male_Upper_", "", mod_table_upper_m$name)
mod_table_upper_m$name <- factor(mod_table_upper_m$name, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic","Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )
data_upper_m$moderator <- gsub("Male_Upper_", "", data_upper_m$moderator)
data_upper_m$moderator <- factor(data_upper_m$moderator, levels = rev(c("Behavioural", "Infectious", "None-infectious", "Chronic", "Other")), 
                                 labels = rev(c("Behavioural", "Infectious\ndisease", "None-infectious\ndisease", 
                                                "Chronic\ndisease", "Other\ncauses")) )

res_upper_m <- list(mod_table = mod_table_upper_m, data = data_upper_m)

class(res_upper_m) <-  c("orchard", "data.frame")
 
p_upper_m <- orchard_plot(res_upper_m, mod = "sex_type",
                          xlab = "Risk difference (Upper)", group = "Species", angle = 0) + ylim(-0.85, 0.7) +  
  theme(axis.title.y = element_blank(), axis.text.y  = element_blank(), axis.ticks.y = element_blank())


# all the data for causes of death saving as rds each (6 of them)

saveRDS(res_lower_f, here("Rdata", "fig", "res_lower_f.rds"))
saveRDS(res_median_f, here("Rdata", "fig", "res_median_f.rds"))
saveRDS(res_upper_f, here("Rdata", "fig", "res_upper_f.rds"))
saveRDS(res_lower_m, here("Rdata", "fig", "res_lower_m.rds"))
saveRDS(res_median_m, here("Rdata", "fig", "res_median_m.rds"))
saveRDS(res_upper_m, here("Rdata", "fig", "res_upper_m.rds"))

######################
# drowning
#########################

p_female <- p_lower_f + p_median_f + p_upper_f +
   plot_annotation(title = "Female")

p_male <- p_lower_m + p_median_m + p_upper_m +
  plot_annotation(title = "Male")

p_female /p_male + plot_layout(heights = c(6,5))

27 PART V: EXTRA FIGURE CODE

Code
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Project: Contraception paper
# Version: 01
# Author:
# Description: Main Figures
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


# INIT ----

rm(list = ls())

# libraries

if (!"devtools" %in% installed.packages())
  install.packages("devtools")
library(devtools)

if (!"tidyverse" %in% installed.packages())
  install.packages("tidyverse")
library(tidyverse)

# Plotting phylogenetic tree
if (!"ggtree" %in% installed.packages())
  install.packages("ggtree")
library(ggtree)

# Aligning plots
if (!"patchwork" %in% installed.packages())
  install.packages("patchwork")
library(patchwork)

# Aligning phylogenetic plots
if (!"aplot" %in% installed.packages())
  install.packages("aplot")
library(aplot)

# Manipulating trees
if (!"ape" %in% installed.packages())
  install.packages("ape")
library(ape)

# Dependency of OrchaRd package
if (!"metafor" %in% installed.packages())
  install.packages("metafor")
library(metafor)

#  Orchard plots
if (!"orchaRd" %in% installed.packages())
  devtools::install_github("daniel1noble/orchaRd", ref = "main", force = TRUE)
library(orchaRd)

# Importing data

library(here)

# Color palettes ----
colpal_sex <- c("Female" = "#de2d26", "Male" = "#4292c6")

colpal_gonads <- c(
  "Gonads not removed \n(female)" = "#de2d26",
  "Gonads removed \n(female)" = "#ee9490",
  "Gonads removed \n(male)" = "#78b1d6"
)

colpal_sextype <- c(
  "Male_surgical" = "#4292c6",
  "Male_hormonal" = "#78b1d6",
  "Female_surgical" = "#ee9490",
  "Female_hormonal" = "#de2d26"
)

colpal_order <- c(
  "Artiodactyla" = "#E69F00",
  "Primates" = "#0072B2",
  "Carnivora" = "#D55E00",
  "Perissodactyla" = "#56B4E9",
  "Diprotodontia" = "#009E73",
  "Rodentia" = "#9966FF",
  "Lagomorpha" = "#CC79A7",
  "Didelphimorphia" = "#F0E442",
  "Chiroptera" = "#999999",
  "Hyracoidea" = "#661100"
)

colpal_cod <- c(
  "Trauma" = "#AA4499",
  "Infectious\ndisease" = "#332288",
  "None-infectious\ndisease" = "#117733",
  "Chronic\ndisease" = "#DDCC77",
  "Death\nat birth" = "#CC6677",
  "Other\ncauses" = "#88CCEE"
)


colpal_contra <- c("Contracepted" = "#D55E00",
                   "Not contracepted" = "#009E73")

colpal_type <- c(
  "Surgical" = "#1b7837",
  "Hormonal" = "#762a83",
  "Immunological" = "#E69F00"
)


colpal_moderator <- c(
  "Controlled" = "#762a83",
  "Not controlled" = "#af8dc3",
  "Sham-controlled" = "#1b7837",
  "No sham" = "#7fbf7b",
  "Wild or \nSemi-wild" = "#01665e",
  "Others \n(e.g., lab, farm)" = "#5ab4ac"
)


# Ggplot themes ----

# Orchard plot theme
theme_orchard <- function(family = "Helvetica") {
  `%+replace%`(
    theme_bw(base_size = 12, base_family = family),
    theme(
      # general plot style
      aspect.ratio = 0.7,
      plot.background = element_blank(),
      plot.margin = margin(
        t = 5.5,
        r = 20,
        b = 5.5,
        l = 0
      ),
      # panel style
      panel.background = element_blank(),
      panel.border = element_rect(
        color = "black",
        fill = NA,
        linewidth = 0.3
      ),
      panel.spacing = unit(0.05, "cm"),
      panel.grid.minor = element_blank(),
      panel.grid.major = element_line(linetype = "solid", linewidth = 0.3),
      # strip style
      strip.background = element_rect(
        color = "black",
        fill = NA,
        linewidth = 0.3
      ),
      strip.text = element_text(size = 9, margin = margin(0.1, 0, 0.1, 0, "cm")),
      # axis settings
      axis.title = element_text(size = 9),
      axis.text = element_text(size = 9),
      axis.line = element_blank(),
      axis.ticks = element_line(linewidth = 0.3),
      axis.ticks.length = unit(.05, "cm"),
      # legend settings
      legend.title = element_text(size = 9),
      legend.text = element_text(size = 8),
      legend.background = element_rect(fill = "transparent", colour = NA),
      legend.position = "bottom",
      legend.key = element_rect(fill = "transparent", colour = NA)
    )
  )
}

# Bar plot theme
theme_bar <- function(family = "Helvetica") {
  `%+replace%`(
    theme_bw(base_size = 9, base_family = family),
    theme(
      plot.background = element_blank(),
      plot.margin = margin(
        t = 0,
        r = 0,
        b = 0,
        l = 0
      ),
      panel.background = element_blank(),
      panel.border = element_rect(
        color = "black",
        fill = NA,
        linewidth = 0.3
      ),
      panel.spacing = unit(0.05, "cm"),
      panel.grid.minor = element_blank(),
      panel.grid.major = element_line(linetype = "solid", linewidth = 0.3),
      strip.background = element_rect(
        color = "black",
        fill = NA,
        linewidth = 0.3
      ),
      strip.text = element_text(margin = margin(0.1, 0, 0.1, 0, "cm"), size = 8),
      axis.title.x = element_text(vjust = -2),
      axis.text.x = element_text(
        size = 6,
        vjust = -1.5,
        color = "black"
      ),
      axis.ticks.x = element_line(linewidth = 0.3),
      axis.title.y = element_blank(),
      axis.text.y = element_blank(),
      axis.ticks.y = element_blank(),
      axis.ticks.length = unit(.05, "cm"),
      legend.position = "none"
    )
  )
}

theme_segment <- function(family = "Helvetica") {
  `%+replace%`(
    theme_bw(base_size = 9, base_family = family),
    theme(
      plot.background = element_blank(),
      plot.margin = margin(
        t = 0,
        r = 0,
        b = 0,
        l = 0
      ),
      panel.background = element_blank(),
      panel.border = element_rect(
        color = "black",
        fill = NA,
        linewidth = 0.3
      ),
      panel.spacing = unit(0.05, "cm"),
      panel.grid.minor = element_blank(),
      panel.grid.major = element_line(linetype = "solid", linewidth = 0.3),
      axis.title.x = element_text(vjust = -2),
      axis.text.x = element_text(
        size = 9,
        vjust = -1.5,
        color = "black"
      ),
      axis.text.y = element_text(
        size = 9,
        colour = "black",
        hjust = 0.95
      ),
      axis.ticks = element_line(linewidth = 0.3),
      axis.ticks.length = unit(.05, "cm"),
      axis.title.y = element_blank(),
      legend.position = "none"
    )
  )
}

# Phylogentic tree theme
theme_phylotree <- function(family = "Helvetica") {
  `%+replace%`(
    theme_bw(base_size = 9, base_family = family),
    theme(
      # plot layout
      plot.margin = margin(
        t = 0,
        r = 0,
        b = 0,
        l = 0
      ),
      plot.background = element_blank(),
      # panel layout
      panel.grid.minor = element_blank(),
      panel.grid.major = element_line(linetype = "solid", linewidth = 0.2),
      panel.background = element_blank(),
      panel.border = element_rect(
        color = "grey70",
        fill = NA,
        linewidth = 0.2
      ),
      panel.spacing = unit(0.1, "cm"),
      # panel.grid.major.y = element_blank(),
      # strip layout
      # strip.background = element_blank(),
      strip.background = element_rect(
        color = "grey70",
        fill = NA,
        linewidth = 0.2
      ),
      strip.text = element_text(margin = margin(0.1, 0, 0.1, 0, "cm")),
      # axis layout
      axis.title = element_text(size = 9),
      axis.text.y = element_blank(),
      axis.line.y = element_blank(),
      axis.line.x = element_line(color = "black", linewidth = 0.3),
      axis.ticks.y = element_blank(),
      axis.text.x = element_text(size = 7),
      axis.ticks.x = element_line(linewidth = 0.3),
      axis.ticks.length.x = unit(.05, "cm"),
      # legend layout
      legend.background = element_rect(fill = "transparent", colour = NA),
      legend.key = element_rect(fill = "transparent", colour = NA),
      legend.title = element_text(size = 7),
      legend.text = element_text(size = 6),
      legend.key.size = unit(0.5, "cm")
    )
  )
}

# Kaplan meier curves theme
theme_km <- function(family = "Helvetica") {
  `%+replace%`(
    theme_bw(base_size = 12, base_family = family),
    theme(
      panel.grid.minor = element_blank(),
      panel.grid.major = element_line(linetype = "solid", linewidth = 0.3),
      plot.title = element_text(face = "bold", hjust = 0),
      # aspect.ratio = 1,
      axis.title.x = element_text(size = 9, vjust = -0.5),
      axis.title.y = element_blank(),
      axis.text = element_text(size = 6),
      axis.line = element_line(linewidth = 0.3),
      axis.ticks = element_line(linewidth = 0.3),
      axis.ticks.length = unit(.05, "cm"),
      legend.title = element_text(size = 9),
      legend.text = element_text(size = 8),
      strip.text = element_text(size = 6, face = "italic"),
      # remove the plot background and border
      plot.background = element_blank(),
      panel.background = element_blank(),
      panel.border = element_blank(),
      panel.spacing = unit(0.05, "cm"),
      # make the legend and strip background transparent
      legend.background = element_rect(fill = "transparent", colour = NA),
      legend.position = "bottom",
      legend.key = element_rect(fill = "transparent", colour = NA),
      strip.background = element_rect(fill = "transparent", colour = NA)
    )
  )
}

# Functions ----

# Plotting function for Kaplan Meier Plots
PlotLifeTab <- function(ltdat, title, ncol = 4) {
  ord <- ltdat %>%
    group_by(species, order) %>%
    tally() %>%
    mutate(Ages = 1, ple = 1, type = NA)
  fig <- ltdat %>%
    ggplot(aes(x = Ages, y = ple, color = type)) +
    geom_rect(
      dat = ord,
      aes(fill = order),
      xmin = -Inf,
      xmax = Inf,
      ymin = -Inf,
      ymax = Inf,
      alpha = 0.2
    ) +
    geom_step(size = 0.4) +
    geom_vline(
      aes(xintercept = minAge),
      lty = 3,
      color = "black",
      size = 0.3
    ) +
    xlab("Age") +
    ylab("Survival") +
    ggtitle(title) +
    facet_wrap(
      . ~ species,
      scales = "free_x",
      strip.position = c("top"),
      ncol = ncol,
      labeller = label_wrap_gen(multi_line = T, width = 18)
    ) +
    scale_color_manual(values = colpal_contra,
                       name = "",
                       na.translate = F) +
    scale_fill_manual(values = colpal_order, name = "") +
    scale_y_continuous(breaks = c(0, 0.5, 1)) +
    expand_limits(x = 0) +
    theme_km() +
    ggh4x::force_panelsizes(rows = unit(1.6, "cm"), cols = unit(1.6, "cm"))
  return(fig)
}


# DATA ----

# Phylogenetic maximum credibility tree
load(here("data2", "maxCredTree.RData"))
tree <- maxCred
rm(maxCred)

# Taxonomy table
tax <- read.csv(here("data2", "FinalTranslTab.csv"))

# Zoo data
dat0 <- read.csv(here("data2", "resultsBaSTApost2005oldFormatFeb2025.csv"))
dat <- dat0 %>% left_join(tax, by = c("species" = "ZIMSspecies"))
dat <- dat %>%
  mutate(phylogeny = gsub(" ", "_", vertlifeSpecies))

# Fixing species name
dat$species[dat$species == "Aonyx cinereus"] <- "Aonyx cinerea"

# Basta summary results post 05
resTab_post05 <- read.csv(file = here("data2", "resultsBaSTApost05.csv"))

# Basta summary results pre 05
resTab_pre05 <- read.csv(file = sprintf(here("data2", "resultsBaSTApre05.csv")))

# Basta summary results before and after maturity
resTab_mat <- read.csv(here("data2", "resultsBaSTAbefAftMatur.csv"))

# Data for Kaplan Meier plots males surgical post 05
dat_males <- read.csv(here("data2", "km_males_surg_post05.csv"))

# Data for Kaplen Meier plots females hormonal pre 05
dat_fem_pre05 <- read.csv(here("data2", "km_females_horm_pre05.csv"))

# Data for Kaplen Meier plots females hormonal pre 05
dat_fem_horm_post05 <- read.csv(here("data2", "km_females_horm_post05.csv"))

# Data for Kaplen Meier plots females surgical post 05
dat_fem_surg_post05 <- read.csv(here("data2", "km_females_surg_post05.csv"))


# excel file with vet responses
vetr <- readxl::read_excel(here("data2", "Species classification as castration or vasectomy_03 AF.xlsx"))

# Load model outputs from zoo_rev2.qmp
load("results/model_outputs/zoo/mod_all3.RData") # Fig 1b)

# Load data generated by literature.qmd
results <- readRDS("results/model_outputs/literature/results.rds") # Fig 3a)
ddat <- readRDS("data2/ddat.rds") # Fig 3a)
load(here("results", "model_outputs/literature/mod_sex1.RData")) # Fig 3b)
load(here("results", "model_outputs/literature/mod_rem.RData")) # Fig 3c)
load(here("results", "model_outputs/literature/mod_con1.RData")) # Fig 4a)
load(here("results", "model_outputs/literature/mod_sham.RData")) # Fig 4b)
load(here("results", "model_outputs/literature/mod_env1.RData")) # Fig 4c)
load(here("results", "model_outputs/literature/mod_sex_mat.RData")) # Fig 5a)
mod_healthspan_sex <- readRDS("results/model_outputs/literature/mod_healthspan_sex.rds")

# Load data on causes of death generated by all.qmd Fig 1c)
res_lower_f <- readRDS(here("results", "model_outputs/zoo/res_lower_f.rds"))
res_upper_f <- readRDS(here("results", "model_outputs/zoo/res_upper_f.rds"))
res_lower_m <- readRDS(here("results", "model_outputs/zoo/res_lower_m.rds"))
res_upper_m <- readRDS(here("results", "model_outputs/zoo/res_upper_m.rds"))

# Fig 3b)
res <- readRDS(here("data2", "res.rds"))
kdat <- readRDS(here("data2", "kdat.rds"))
ldat <- readRDS(here("data2", "ldat.rds"))

# FIGURES ----

# Fig 1 ----
# Fig 1a) Phylo tree lifespans ----
# Phylo tree zoos with lifespans

# recalculated these rations with the new data - Please check if this is correct!
pdat2 <- dat %>% mutate(
  lrr_surgical_m = (Male_Surgical_Contra_Mean / Male_Surgical_NoContra_Mean - 1) * 100,
  lrr_surgical_f = (
    Female_Surgical_Contra_Mean / Female_Surgical_NoContra_Mean - 1
  ) * 100,
  lrr_hormonal_m = (Male_Hormonal_Contra_Mean / Male_Hormonal_NoContra_Mean - 1) * 100,
  lrr_hormonal_f = (
    Female_Hormonal_Contra_Mean / Female_Hormonal_NoContra_Mean - 1
  ) * 100
)

# reformat data to long format
pdat3 <- pdat2 %>% select(
  species,
  vertlifeSpecies,
  order,
  phylogeny,
  lrr_surgical_m,
  lrr_surgical_f,
  lrr_hormonal_m,
  lrr_hormonal_f
)

pdat_long <- pdat3 %>% pivot_longer(cols = c(
  lrr_surgical_m,
  lrr_surgical_f,
  lrr_hormonal_m,
  lrr_hormonal_f
))

pdat_long %>% mutate(sex = rep(c("male", "female"), nrow(pdat_long) / 2), type = rep(
  c("surgical", "surgical", "hormonal", "hormonal"),
  nrow(pdat_long) / 4
)) -> pdat_long

pdat_long %>% mutate(
  min_value = ifelse(is.na(value) == TRUE, NA, ifelse(value < 0, value, 0)),
  max_value = ifelse(is.na(value) == TRUE, NA, ifelse(value > 0, value, 0))
) -> pdat_long

pdat_long$type <- factor(
  pdat_long$type,
  levels = c("surgical", "hormonal"),
  labels = c("Surgical", "Hormonal")
)

# Subset tree
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% pdat_long$phylogeny))]

to_drop # Why not in tree?

tree_subset <- drop.tip(tree, to_drop)

table(tree_subset$tip.label %in% pdat_long$phylogeny)
table(pdat_long$phylogeny %in% tree_subset$tip.label)

pdat_long <- pdat_long[which(pdat_long$phylogeny %in% tree_subset$tip.label), ]

#  use getMRCA() to obtain common ancestor nodes to position the order silhouttes
tree.tibble <- tidytree::as_tibble(tree_subset)
ord <- unique(pdat_long$order)

dford <- data.frame(order = ord, node = NA)

for (i in ord) {
  tip <- unique(as.data.frame(pdat_long[which(pdat_long$order == i), "phylogeny"])$phylogeny)
  if (length(tip) > 1) {
    tnode <- getMRCA(tree_subset, tip = tip)
  } else if (length(tip) == 1) {
    tnode <-
      match(tip, tree.tibble$label)
  }
  
  dford[dford$order == i, "node"] <- tnode
}

# merge dford with color palette
dford <- colpal_order %>%
  as.data.frame() %>%
  rownames_to_column() %>%
  rename(order = rowname, color = ".") %>%
  right_join(dford, by = c("order"))

# for orders with less than 2 species we remove the color
dford[dford$order %in% c("Hyracoidea", "Didelphimorphia", "Lagomorpha"), "color"] <- NA

p <- ggtree(
  tree_subset,
  layout = "rectangular",
  ladderize = T,
  size = 0.2,
  color = "grey50"
) +
  xlim(0, 180) +
  geom_hilight(node = dford$node,
               fill = dford$color,
               alpha = .2)
p



#  barplot showing male surgical and female hormonal
p_bar <- pdat_long %>%
  filter(!(type == "Surgical" &
             sex == "female"),
         !(type == "Hormonal" &
             sex == "male")) %>%
  mutate(
    sex = case_match(sex, "female" ~ "Female", "male" ~ "Male"),
    sex = factor(sex, levels = c("Male", "Female")),
    type = case_match(type, "Surgical" ~ "Male surgical", "Hormonal" ~ "Female hormonal"),
    type = factor(type, levels = c("Male surgical", "Female hormonal"))
  ) %>%
  ggplot(aes(x = value, y = phylogeny, fill = sex)) +
  geom_col() +
  scale_fill_manual(values = colpal_sex, name = "Sex") +
  geom_vline(
    aes(xintercept = 0),
    lty = 3,
    color = "black",
    linewidth = 0.3
  ) +
  facet_wrap( ~ type,
              ncol = 2,
              labeller = label_wrap_gen(multi_line = T, width = 15)) +
  scale_x_continuous(breaks = scales::pretty_breaks(n = 5)) +
  theme_phylotree() +
  xlab("Ratio: Contracepted / Normal (%)") +
  ylab("") +
  theme(legend.position = "none")
p_bar


# final fig
# we use aplot to properly match the bars to the phylo plots (does not work with patchwork)
p_tree_final <- p_bar %>% aplot::insert_left(p, width = c(0.8, 1))
p_tree_final

ggsave(
  here("results", "plots", "Fig1a_phylotreeZIMS.pdf"),
  width = 100,
  height = 125,
  units = "mm"
)

# Fig 1b) Orchard plots sex & contraception type ----
theme_orchard_updated <- theme_orchard() +
  theme(
    legend.position = "right",
    aspect.ratio = 0.7,
    axis.text = element_text(size = 11),
    axis.title = element_text(size = 11)
  )

p_combo <- orchard_plot(mod_all3,
                        group = "species",
                        xlab = "LnRR (Effect size)",
                        mod = "sex_type") +
  theme_orchard() +
  scale_colour_manual(values = colpal_sextype) +
  scale_fill_manual(values = colpal_sextype) +
  scale_x_discrete(labels = rev(
    c(
      "Male surgical",
      "Male hormonal",
      "Female surgical",
      "Female hormonal"
    )
  )) +
  theme_orchard_updated
p_combo
#ggsave("results/plots/Fig1b_orchardZIMS.pdf", width = 100, units = "mm")

# Fig 1c) Causes of death ----

p_lower_f <- orchard_plot(
  res_lower_f,
  mod = "sex_type",
  xlab = "Risk difference (Young adult)",
  group = "Species",
  angle = 0
) + ylim(-0.85, 0.7) +
  theme_orchard() +
  scale_x_discrete(labels = rev(
    c(
      "Behaviour",
      "Infectious disease",
      "Non-infectious disease",
      "Chronic disease",
      "Death at birth",
      "Other causes"
    )
  )) +
  scale_colour_manual(values = colpal_cod) +
  scale_fill_manual(values = colpal_cod) +
  theme_orchard_updated

p_upper_f <- orchard_plot(
  res_upper_f,
  mod = "sex_type",
  xlab = "Risk difference (Old adult)",
  group = "Species",
  angle = 0
) + ylim(-0.85, 0.7) +
  theme_orchard() +
  scale_x_discrete(labels = rev(
    c(
      "Behaviour",
      "Infectious disease",
      "Non-infectious disease",
      "Chronic disease",
      "Death at birth",
      "Other causes"
    )
  )) +
  scale_colour_manual(values = colpal_cod) +
  scale_fill_manual(values = colpal_cod) +
  theme_orchard_updated

p_lower_m <- orchard_plot(
  res_lower_m,
  mod = "sex_type",
  xlab = "Risk difference (Young adult)",
  group = "Species",
  angle = 0
) + ylim(-0.85, 0.7) +
  scale_x_discrete(labels = rev(
    c(
      "Behaviour",
      "Infectious disease",
      "Non-infectious disease",
      "Chronic disease",
      "Other causes"
    )
  )) +
  theme_orchard() +
  scale_colour_manual(values = colpal_cod) +
  scale_fill_manual(values = colpal_cod) +
  theme_orchard_updated

p_upper_m <- orchard_plot(
  res_upper_m,
  mod = "sex_type",
  xlab = "Risk difference (Old adult)",
  group = "Species",
  angle = 0
) + ylim(-0.85, 0.7) +
  scale_x_discrete(labels = rev(
    c(
      "Behaviour",
      "Infectious disease",
      "Non-infectious disease",
      "Chronic disease",
      "Other causes"
    )
  )) +
  theme_orchard() +
  scale_colour_manual(values = colpal_cod) +
  scale_fill_manual(values = colpal_cod) +
  theme_orchard_updated


p_combo +  p_upper_m + p_upper_f + plot_layout(ncol = 1)
ggsave(
  "results/plots/Fig1bc_SexType_CausesOfDeath.pdf",
  width = 170,
  height = 330,
  units = "mm"
)


# Fig 2 - Kaplan Meier survival  -----

# plotting order for taxonomic orders
order_levs <- c(
  "Artiodactyla",
  "Perissodactyla",
  "Carnivora",
  "Chiroptera",
  "Primates",
  "Rodentia",
  "Lagomorpha",
  "Diprotodontia",
  "Didelphimorphia"
)

# Fig 2a) Vasectomy ----
# Vasectomy post 2005
# subset species with vasectomy from vet response file
sp_vasec <- vetr %>%
  filter(`Castration or Vasectomy` == "Likely vasectomized") %>%
  pull(Species)
# remove lions as it will be in panel D
dat_vasec <- dat_males %>% filter(species %in% sp_vasec)

# change species order according to taxonomic orders
dat_vasec <- dat_vasec %>% arrange(factor(order, levels = order_levs), species)
dat_vasec$species <- factor(dat_vasec$species, levels = unique(dat_vasec$species))

# Plot
PlotLifeTab(ltdat = dat_vasec, title = "Males - Vasectomy")

ggsave(here("results", "plots", "Fig2a_Males_VasecPost05.pdf"))

# Fig 2b) Castration ----

# Castration post 2005
# subset species with castration from vet response file
sp_castr <- vetr %>%
  filter(`Castration or Vasectomy` == "Castration") %>%
  pull(Species)
# only species with > 80 individuals in the contraception group
#sp_castr <- sp_castr[sp_castr %in% resTab_post05[resTab_post05$Ncontra >= 80, "Species"]]

dat_castr <- dat_males %>% filter(species %in% sp_castr)

# order species names by order
dat_castr <- dat_castr %>% arrange(factor(order, levels = order_levs), species)
dat_castr$species <- factor(dat_castr$species, levels = unique(dat_castr$species))

# Plot
PlotLifeTab(ltdat = dat_castr,
            title = "Castration (males)",
            ncol = 5)

# Save plot
ggsave(here("results", "plots", "Fig2b_Males_Castrpost05.pdf"))


# Fig 2c) Hormonal ----

# Hormonal post 2005 females
# change species order according to taxonomic orders
dat_fem_horm_post05 <- dat_fem_horm_post05 %>% arrange(factor(order, levels = order_levs), species)
dat_fem_horm_post05$species <- factor(dat_fem_horm_post05$species,
                                      levels = unique(dat_fem_horm_post05$species))

# only species with > 80 individuals in the contraception group
sp_fhorm <- as.character(unique(dat_fem_horm_post05$species))
sp_fhorm <- sp_fhorm[sp_fhorm %in% resTab_post05[resTab_post05$Ncontra >= 70 &
                                                   resTab_post05$Sex == "Female" &
                                                   resTab_post05$Type == "Hormonal", "Species"]]
sort(sp_fhorm)
# exlude lions as they will be in panel D
sp_fhorm <- sp_fhorm[!sp_fhorm == "Panthera leo"]
dat_fem_horm_post05_sub <- dat_fem_horm_post05 %>% filter(species %in% sp_fhorm)

# Plot
PlotLifeTab(ltdat = dat_fem_horm_post05_sub,
            title = "Hormonal (females)",
            ncol = 5)
ggsave(here("results", "plots", "Fig2c_Females_Hormonalpost05.pdf"))



# Fig 2d) Female lions ----

# Females progesterone based contraception
flion_prog <- dat_fem_pre05 %>% filter(species == "Panthera leo")
flion_prog$method <- "Progesterone"
flion_gnrh <- dat_fem_horm_post05 %>% filter(species == "Panthera leo")
flion_gnrh$method <- "GnRH"
flion_surg <- dat_fem_surg_post05 %>% filter(species == "Panthera leo")
flion_surg$method <- "Surgical"

dat_flion <- rbind(flion_prog, flion_gnrh, flion_surg)
dat_flion$method <- factor(dat_flion$method, levels = c("Progesterone", "GnRH", "Surgical"))
levels(dat_flion$method)
p_lion <- ggplot(dat_flion, aes(x = Ages, y = ple, color = type)) +
  geom_rect(
    dat = ord,
    aes(fill = order),
    xmin = -Inf,
    xmax = Inf,
    ymin = -Inf,
    ymax = Inf,
    alpha = 0.2
  ) +
  geom_step(size = 0.4) +
  geom_vline(
    aes(xintercept = minAge),
    lty = 3,
    color = "black",
    size = 0.3
  ) +
  xlab("Age") +
  ylab("Survival") +
  ggtitle("Panthera leo") +
  facet_wrap(
    . ~ method,
    scales = "free_x",
    strip.position = c("top"),
    ncol = 3,
    labeller = label_wrap_gen(multi_line = T, width = 18)
  ) +
  scale_color_manual(values = colpal_contra,
                     name = "",
                     na.translate = F) +
  scale_fill_manual(values = colpal_order, name = "") +
  scale_y_continuous(breaks = c(0, 0.5, 1)) +
  expand_limits(x = 0) +
  theme_km() +
  ggh4x::force_panelsizes(rows = unit(1.6, "cm"), cols = unit(1.6, "cm"))
p_lion
ggsave(here("results", "plots", "Fig2d_female_lions.pdf"))



# Fig 3 Meta analysis -----
# Fig 3a) Lifespan bar plot ----

sum_data <- data.frame(
  "x.diamond" = c(
    results$lowerCL,
    results$estimate,
    results$upperCL,
    results$estimate
  ),
  "y.diamond" = c(1, 1 + 0.25, 1, 1 - 0.25)
)

ddat$Species_Latin <- factor(
  ddat$Species_Latin,
  levels = c(
    "Overall",
    "Lamperta fluviatilis",
    # fish
    "Oncorhynchus nerka",
    # fish
    "Oncorhynchus masou",
    # fish
    "Anolis sagrei",
    # lizard
    "Phascolarctos cinereus",
    # masp
    "Trichosurus vulpecula",
    # masp?
    "Oryctolagus cuniculus",
    # rabbit
    "Mesocricetus auratus",
    "Myodes glareolus",
    # voles
    "Rattus norvegicus",
    # rat
    "Rattus argentiventer",
    # rat
    "Mus musculus",
    "Ovis aries",
    "Equus ferus",
    "Odocoileus virginianus",
    "Vulpes vulpes",
    "Canis lupus",
    "Felis catus",
    "Varecia variegata",
    "Varecia rubra",
    "Macaca fascicularis",
    "Homo sapiens"
  ),
  labels = c(
    "Overall",
    "Lamperta fluviatilis",
    # fish
    "Oncorhynchus nerka",
    # fish
    "Oncorhynchus masou",
    # fish
    "Anolis sagrei",
    # lizard
    "Phascolarctos cinereus",
    # masp
    "Trichosurus vulpecula",
    # masp?
    "Oryctolagus cuniculus",
    # rabbit
    "Mesocricetus auratus",
    "Myodes glareolus",
    # voles
    "Rattus norvegicus",
    # rat
    "Rattus argentiventer",
    # rat
    "Mus musculus",
    "Ovis aries",
    "Equus ferus",
    "Odocoileus virginianus",
    "Vulpes vulpes",
    "Canis lupus",
    "Felis catus",
    "Varecia variegata",
    "Varecia rubra",
    "Macaca fascicularis",
    "Homo sapiens"
  )
)


phy_sex <- ggplot(data = ddat, aes(x = yi, y = Species_Latin)) +
  geom_vline(xintercept = 0,
             linetype = 2,
             colour = "black") +
  geom_vline(
    xintercept = results$estimate,
    linetype = 1,
    colour = "red"
  ) +
  geom_errorbarh(
    aes(
      xmin = lower.ci,
      xmax = upper.ci,
      colour = Sex
    ),
    height = 0,
    show.legend = TRUE,
    linewidth = 3,
    position = position_dodge(width = 0.75)
  ) +
  geom_point(
    aes(col = Sex),
    fill = "white",
    size = 1.6,
    shape = 21,
    position = position_dodge2(width = 0.75)
  ) +
  coord_cartesian(xlim = c(-1, 1.5)) +
  #xlim(-1.3, 1.6) +
  # creating 95% prediction intervals
  geom_segment(data = results,
               ggplot2::aes(
                 x = lowerPR,
                 y = 1,
                 xend = upperPR,
                 yend = 1,
                 group = name
               )) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data,
                        ggplot2::aes(x = x.diamond, y = y.diamond),
                        fill = "red") +
  scale_color_manual(values = colpal_sex) +
  labs(x = "LnRR (Effect size)", y = "", colour = "Sex") +
  theme_segment() +
  theme(axis.text.y = element_text(face = "italic"))

phy_sex
# adding icons
filenames <- list.files(here("icons2", "literature"),
                        pattern = ".png",
                        full.names = TRUE)
ldf <- lapply(filenames, png::readPNG)
names(ldf) <- substr(filenames, 18, 18 + 60)

xpos <- c(-1.2, -0.5)

phy_sex <- phy_sex +
  annotation_custom(
    grid::rasterGrob(ldf$Lampetra_fluviatilis.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 1.5,
    ymax = 2.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Oncorhynchus_nerka.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 2.5,
    ymax = 3.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Oncorhynchus_masou.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 3.5,
    ymax = 4.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Anolis_sagrei.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 4.5,
    ymax = 5.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Phascolarctos_cinereus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 5.5,
    ymax = 6.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Trichosurus_vulpecula.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 6.5,
    ymax = 7.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Oryctolagus_cuniculus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 7.5,
    ymax = 8.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Mesocricetus_auratus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 8.5,
    ymax = 9.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Myodes_glareolus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 9.5,
    ymax = 10.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_norvegicus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 10.5,
    ymax = 11.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_argentiventer.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 11.5,
    ymax = 12.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Mus_musculus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 12.5,
    ymax = 13.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Ovis_aries.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 13.5,
    ymax = 14.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Equus_ferus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 14.5,
    ymax = 15.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Odocoileus_virginianus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 15.5,
    ymax = 16.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Vulpes_vulpes.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 16.5,
    ymax = 17.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Canis_lupus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 17.5,
    ymax = 18.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Felis_catus.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 18.5,
    ymax = 19.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Varecia_variegata.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 19.5,
    ymax = 20.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Varecia_rubra.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 20.5,
    ymax = 21.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Macaca_Fascicularis.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 21.5,
    ymax = 22.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Homo_sapiens.png),
    xmin = xpos[1],
    xmax = xpos[2],
    ymin = 22.5,
    ymax = 23.5
  )

phy_sex


# Fig 3b) Healthspan ----
sum_data <- data.frame(
  "x.diamond" = c(res$lowerCL, res$estimate , res$upperCL, res$estimate),
  "y.diamond" = c(1, 1 + 0.25, 1, 1 - 0.25)
)

# plotting Sub.measure
# looking at
#dat$Sub.measure
kdat$Sub.measure <- factor(kdat$Sub.measure,
                           levels = rev(
                             c(
                               "Cardiac\nfunction/\npathology",
                               "Cardiac size",
                               "Cognition",
                               "Frailty",
                               "Immune\nfunction",
                               "Metabolism",
                               "Muscle size",
                               "Non-tumor\npathology",
                               "Sensory\nfunction",
                               "Strength/\nbalance",
                               "Tumor\nmammory",
                               "Tumor\nnonmammory",
                               "Voluntary\nactivity",
                               "Overall"
                             )
                           ),
                           labels = rev(
                             c(
                               "Cardiac function/\npathology",
                               "Cardiac size",
                               "Cognition",
                               "Frailty",
                               "Immune function",
                               "Metabolism",
                               "Muscle size",
                               "Non-tumor\npathology",
                               "Sensory function",
                               "Strength/balance",
                               "Tumor mammory",
                               "Tumor\nnon-mammory",
                               "Voluntary activity",
                               "Overall"
                             )
                           ))
## version 1 ----

mes_sex1 <- ggplot(data = kdat, aes(x = yi, y = Sub.measure)) +
  geom_vline(xintercept = 0,
             linetype = 2,
             colour = "black") +
  geom_vline(
    xintercept = res$estimate,
    linetype = 1,
    colour = "red"
  ) +
  geom_errorbarh(
    aes(
      xmin = lower.ci,
      xmax = upper.ci,
      colour = Sex
    ),
    height = 0,
    show.legend = TRUE,
    linewidth = 3,
    position = position_dodge(width = 0.75)
  ) +
  geom_point(
    aes(col = Sex),
    fill = "white",
    size = 1.6,
    shape = 21,
    position = position_dodge2(width = 0.75)
  ) +
  xlim(-1.6, 1.6) +
  #creating 95% prediction intervals
  geom_segment(data = res,
               ggplot2::aes(
                 x = lowerPR,
                 y = 1,
                 xend = upperPR,
                 yend = 1,
                 group = name
               )) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data,
                        ggplot2::aes(x = x.diamond, y = y.diamond),
                        fill = "red") +
  scale_color_manual(values = colpal_sex) +
  labs(x = "LnRR (Effect size)", y = "", colour = "Sex") +
  theme_segment() +
  theme(legend.position = "bottom") 
mes_sex1

mes_sex1 <- mes_sex1 + 
  annotation_custom(
  grid::rasterGrob(ldf$Mus_musculus.png),
  xmin = -1.5,
  xmax = -0.7,
  ymin = 12.5,
  ymax = 15
) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_argentiventer.png),
    xmin = -1,
    xmax = -0.3,
    ymin = 12.5,
    ymax = 14
  )

## version 2 ----
# with cutoff x-axis
mes_sex2 <- ggplot(data = kdat, aes(x = yi, y = Sub.measure)) +
  geom_vline(xintercept = 0,
             linetype = 2,
             colour = "black") +
  geom_vline(
    xintercept = res$estimate,
    linetype = 1,
    colour = "red"
  ) +
  geom_errorbarh(
    aes(
      xmin = lower.ci,
      xmax = upper.ci,
      colour = Sex
    ),
    height = 0,
    show.legend = TRUE,
    linewidth = 3,
    position = position_dodge(width = 0.75)
  ) +
  geom_point(
    aes(col = Sex),
    fill = "white",
    size = 1.6,
    shape = 21,
    position = position_dodge2(width = 0.75)
  ) +
  coord_cartesian(xlim = c(-0.5, 0.85)) +
  #creating 95% prediction intervals
  geom_segment(data = res,
               ggplot2::aes(
                 x = lowerPR,
                 y = 1,
                 xend = upperPR,
                 yend = 1,
                 group = name
               )) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data,
                        ggplot2::aes(x = x.diamond, y = y.diamond),
                        fill = "red") +
  scale_color_manual(values = colpal_sex) +
  labs(x = "LnRR (Effect size)", y = "", colour = "Sex") +
  theme_segment() +
  theme(legend.position = "bottom") +
  # add left arrrow
  geom_segment(
    data = subset(kdat, upper.ci < -0.5),
    aes(
      x = -0.4,
      y = Sub.measure,
      xend = -0.55,
      yend = Sub.measure
    ),
    arrow = arrow(length = unit(0.2, "cm"), type = "closed"),
    color = "grey30",
    size = 1.2
  )
mes_sex2

mes_sex2 <- mes_sex2 + 
  annotation_custom(
    grid::rasterGrob(ldf$Mus_musculus.png),
    xmin = -0.5,
    xmax = -0.2,
    ymin = 12.5,
    ymax = 15
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_argentiventer.png),
    xmin = -0.4,
    xmax = -0.1,
    ymin = 12,
    ymax = 14
  )


## version 3 ----
# remove immune function
mes_sex3 <- kdat %>% filter(!Sub.measure == "Immune function") %>%
  ggplot(aes(x = yi, y = Sub.measure)) +
  geom_vline(xintercept = 0,
             linetype = 2,
             colour = "black") +
  geom_vline(
    xintercept = res$estimate,
    linetype = 1,
    colour = "red"
  ) +
  geom_errorbarh(
    aes(
      xmin = lower.ci,
      xmax = upper.ci,
      colour = Sex
    ),
    height = 0,
    show.legend = TRUE,
    linewidth = 3,
    position = position_dodge(width = 0.75)
  ) +
  geom_point(
    aes(col = Sex),
    fill = "white",
    size = 1.6,
    shape = 21,
    position = position_dodge2(width = 0.75)
  ) +
  coord_cartesian(xlim = c(-0.5, 0.85)) +
  #creating 95% prediction intervals
  geom_segment(data = res,
               ggplot2::aes(
                 x = lowerPR,
                 y = 1,
                 xend = upperPR,
                 yend = 1,
                 group = name
               )) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data,
                        ggplot2::aes(x = x.diamond, y = y.diamond),
                        fill = "red") +
  scale_color_manual(values = colpal_sex) +
  labs(x = "LnRR (Effect size)", y = "", colour = "Sex") +
  theme_segment() +
  theme(legend.position = "bottom")


mes_sex3 <- mes_sex3 + 
  annotation_custom(
    grid::rasterGrob(ldf$Mus_musculus.png),
    xmin = -0.5,
    xmax = -0.2,
    ymin = 11,
    ymax = 15
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_argentiventer.png),
    xmin = -0.4,
    xmax = -0.1,
    ymin = 11,
    ymax = 13
  )
mes_sex3

# Align and save Figure 3
phy_sex + mes_sex + plot_layout(guides = 'keep')
ggsave(
  "results/plots/Fig3ab_life_healthspan.pdf",
  width = 170,
  units = "mm",
  height = 160
)

phy_sex + mes_sex2 + plot_layout(guides = 'keep')
ggsave(
  "results/plots/Fig3ab_life_healthspan_v2.pdf",
  width = 165,
  units = "mm",
  height = 160
)

phy_sex + mes_sex3 + plot_layout(guides = 'keep')
ggsave(
  "results/plots/Fig3ab_life_healthspan_v3.pdf",
  width = 165,
  units = "mm",
  height = 160
)




# Fig 4 - Moderator effects ----
# Fig 4a) Sex ----
mod_sex1$data$Sex <- factor(mod_sex1$data$Sex, levels = rev(c("Male", "Female")))

p_sex <- orchard_plot(
  mod_sex1,
  mod = "Sex",
  xlab = "LnRR (Effect size)",
  group = "Study",
  cb = F,
  angle = 0
) +
  theme_orchard() +
  scale_fill_manual(values = colpal_sex) +
  scale_color_manual(values = colpal_sex) +
  theme(legend.position = "none")

p_sex


# Fig 4b) Gonad removal ----
mod_rem$data$Sex_Gonads <- factor(mod_rem$data$Sex_Gonads, levels = rev(
  c(
    "Gonads removed \n(male)",
    "Gonads not removed \n(female)",
    "Gonads removed \n(female)"
  )
))

p_gonad <- orchard_plot(
  mod_rem,
  mod = "Sex_Gonads",
  xlab = "LnRR (Effect size)",
  group = "Study",
  cb = F,
  angle = 0
) +
  theme_orchard() +
  theme(legend.position = "none") +
  scale_fill_manual(values = colpal_gonads) +
  scale_color_manual(values = colpal_gonads)

p_gonad

# Fig 4c)  Control ----
# Effects of different moderators

p_mod <- orchard_plot(mod_con1,
                      mod = "Controlled_treatments",
                      xlab = "LnRR (Effect size)",
                      group = "Study") +
  scale_fill_manual(values = colpal_moderator) +
  scale_colour_manual(values = colpal_moderator) +
  theme_orchard() +
  theme(legend.position = "none")

p_mod

# Fig 4d) Sham ----

p_sham <- orchard_plot(mod_sham,
                       mod = "Shamtreatment_moderator",
                       xlab = "Log response ratio (lnRR)",
                       group = "Study") +
  scale_fill_manual(values = colpal_moderator) +
  scale_colour_manual(values = colpal_moderator) +
  theme_orchard() +
  theme(legend.position = "none")

p_sham

# Fig 4e) Environment -----

p_env <- orchard_plot(mod_env1,
                      mod = "Wild_or_semi_wild",
                      xlab = "LnRR (Effect size)",
                      group = "Study") +
  scale_fill_manual(values = colpal_moderator) +
  scale_colour_manual(values = colpal_moderator) +
  theme_orchard() +
  scale_x_discrete(labels = c("Others \n(e.g., lab, farm)", "Wild or \nsemi-wild"))
p_env

# Fig 4f) Healthspan ----
# orchard_healthspan
p_health <- orchard_plot(mod_healthspan_sex,
                         mod = "Sex",
                         xlab = "LnRR (Effect size)",
                         group = "Study") +
  scale_fill_manual(values = colpal_sex) +
  scale_colour_manual(values = colpal_sex) +
  theme_orchard()
p_health

# Align and save Figure 4

p_sex + p_gonad +  p_mod +  p_sham + p_env  + p_health + plot_layout(guides = "keep", ncol = 1)

p_mod + p_sham + p_env + plot_layout(guides = "keep",
                                     ncol = 1,
                                     axes = "collect")




ggsave(
 here("results", "plots", "Fig4_Moderator_plot.pdf"),
  width = 200,
  height = 170,
  units = "mm"
)

# Fig 5 - Timing of contraception ----
# Fig 5a) ----

# Males should come before females in the plot, but for some reason it does not change if i change the factor levels...

mod_sex_mat$data$Sex <- factor(mod_sex_mat$data$Sex, levels = rev(c("Male", "Female")))
levels(mod_sex_mat$data$Sex)

p_mat <- bubble_plot(
  mod_sex_mat,
  xlab = "Life-course stages",
  ylab = "LnRR (Effect size)",
  mod = "Maturity_at_treatment_ordinal",
  group = "Study",
  by = "Sex",
  condition.nrow = 2
) +
  theme_orchard() +
  scale_fill_manual(values = colpal_sex) +
  theme(aspect.ratio = 0.7)
p_mat
ggsave(
  here("results", "plots", "Fig5a_bubbleplot.pdf"),
  width = 100,
  height = 100,
  units = "mm"
)


# Fig 5b) ----
# Phylo tree before and after maturity

tree <- maxCred
# rm(maxCred)

# join tax to data
resTab_mat <- resTab_mat %>% left_join(tax, by = c("Species" = "ZIMSspecies"))

# Calculate life expectancy difference (before: contraception before age at mat / after: contraception after age at mat)
resTab_mat$bef <- log(resTab_mat$LifeExpContraBef / resTab_mat$LifeExpNoContra)
resTab_mat$aft <- log(resTab_mat$LifeExpContraAft / resTab_mat$LifeExpNoContra)

resTab_mat$vertlifeSpecies <- gsub(" ", "_", resTab_mat$vertlifeSpecies)

# Subset tree
to_drop <-
  tree$tip.label[which(!(tree$tip.label %in% resTab_mat$vertlifeSpecies))]
tree_subset <- drop.tip(tree, to_drop)

#  Use getMRCA() to obtain common ancestor nodes to position the order silhouttes
tree.tibble <- tidytree::as_tibble(tree_subset)
ord <- unique(resTab_mat$order)

dford <- data.frame(order = ord, node = NA)

for (i in ord) {
  tip <- resTab_mat[which(resTab_mat$order == i), "vertlifeSpecies"]
  if (length(tip) > 1) {
    tnode <- getMRCA(tree_subset, tip = tip)
  } else if (length(tip) == 1) {
    tnode <-
      match(tip, tree.tibble$label)
  }
  
  dford[dford$order == i, "node"] <- tnode
}

# merge dford with color palette
dford <- colpal_order %>%
  as.data.frame() %>%
  rownames_to_column() %>%
  rename(order = rowname, color = ".") %>%
  right_join(dford, by = c("order"))

resTab_mat <- resTab_mat %>%
  select(Species, vertlifeSpecies, order, bef, aft) %>%
  pivot_longer(cols = c("bef", "aft"))

# replace tree names with the ZIMS names
sp <- unique(resTab_mat[order(match(resTab_mat$vertlifeSpecies, tree_subset$tip.label)), "Species"])
tree_subset$tip.label <- sp$Species

# plot
p_tree <- ggtree(
  tree_subset,
  layout = "rectangular",
  ladderize = T,
  size = 0.2,
  color = "grey50"
) +
  xlim(0, 300) +
  geom_tiplab(fontface = 3, size = 2) +
  geom_hilight(node = dford$node,
               fill = dford$color,
               alpha = .2)
p_tree

# Plot of life expectancy differences
p_bar <- resTab_mat %>%
  mutate(
    name = case_match(name, "bef" ~ "Before maturity", "aft" ~ "After maturity"),
    name = factor(name, levels = c("Before maturity", "After maturity")),
  ) %>%
  ggplot(aes(x = value, y = Species)) +
  geom_col(width = 0.6, fill = "grey40") +
  xlab("Log ratio: Contraceptive / Normal") +
  ylab("") +
  facet_wrap(. ~ name) +
  theme_bar()
p_bar

# Combine phylo tree and bar plot using aplot
p_tree_mat <- p_bar %>% aplot::insert_left(p_tree, width = c(1, 1))
p_tree_mat

ggsave(
  here("results", "plots", "Fig5b_Phyloplot_mat.pdf"),
  width = 100,
  height = 120,
  units = "mm"
)

# Fig S1) - Supplemental Kaplan Meier ----

# Fig S2 - Supplemental Measurement type Healthspan ----


#gdat$S
ldat$Measurement.type <- factor(ldat$Measurement.type,
                                levels = rev(
                                  c(
                                    "Adrenal-Cortical adenoma",
                                    "Autoshaping learning test",
                                    "balance on a dowel",
                                    "Barnes maze test",
                                    "cardiac fibrosis",
                                    "Cardiac pathology",
                                    "Cardiomyocyte size",
                                    "E/A ratio",
                                    "Ejection fraction",
                                    "Energy expenditure",
                                    "fractional shortening",
                                    "Frailty score",
                                    "Glucose tolerance",
                                    "Grip strength",
                                    "Harderian adenoma",
                                    "Heart size",
                                    "inhibitory avoidance test",
                                    "Insulin sensitivity",
                                    "Kidney pathology",
                                    "left ventricle size",
                                    "Left Ventricular Isovolumic Relaxation Time",
                                    "Liver pathology",
                                    "Mammary pathology",
                                    "Morris water maze",
                                    "nonthymic lymphosarcoma",
                                    "novel object recognition",
                                    "Open field test",
                                    "pituitary tumors",
                                    "Polyarteritis",
                                    "Proportion with hypophyseal adenoma",
                                    "Proportion with tumors ",
                                    "Pulmonary adenoma",
                                    "Quadriceps size",
                                    "RAM memory test",
                                    "Reticulum cell sarcoma",
                                    "rotarod",
                                    "Skeletal muscle fiber size",
                                    "Smell preference",
                                    "superficial skin and subcutaneous tumor not mammary",
                                    "T cell function test",
                                    "T maze test",
                                    "thymic lymphomas",
                                    "Total activity dark period",
                                    "total non-neoplastic lesions",
                                    "Treamill",
                                    "vision presence of cataracts",
                                    "voluntary activity assessment",
                                    "voluntary wheel running",
                                    "water radial arm maze test",
                                    "Y maze testing",
                                    "Overall"
                                  )
                                ),
                                labels = rev(
                                  c(
                                    "Adrenal-cortical adenoma",
                                    "Autoshaping learning test",
                                    "Balance on a dowel",
                                    "Barnes maze test",
                                    "Cardiac fibrosis",
                                    "Cardiac pathology",
                                    "Cardiomyocyte size",
                                    "E/A ratio",
                                    "Ejection fraction",
                                    "Energy expenditure",
                                    "Fractional shortening",
                                    "Frailty score",
                                    "Glucose tolerance",
                                    "Grip strength",
                                    "Harderian adenoma",
                                    "Heart size",
                                    "Inhibitory avoidance test",
                                    "Insulin sensitivity",
                                    "Kidney pathology",
                                    "Left ventricle size",
                                    "Left ventricular IRT",
                                    "Liver pathology",
                                    "Mammary pathology",
                                    "Morris water maze",
                                    "Nonthymic lymphosarcoma",
                                    "Novel object recognition",
                                    "Open field test",
                                    "Pituitary tumors",
                                    "Polyarteritis",
                                    "Prop. with hypophyseal adenoma",
                                    "Proportion with tumors",
                                    "Pulmonary adenoma",
                                    "Quadriceps size",
                                    "RAM memory test",
                                    "Reticulum cell sarcoma",
                                    "Rotarod",
                                    "Skeletal muscle fiber size",
                                    "Smell preference",
                                    "Superfic. skin & subcut. tumor n.m.",
                                    "T cell function test",
                                    "T maze test",
                                    "Thymic lymphomas",
                                    "Total activity dark period",
                                    "Total non-neoplastic lesions",
                                    "Treadmill",
                                    "Vision presence of cataracts",
                                    "Voluntary activity assessment",
                                    "Voluntary wheel running",
                                    "Water radial arm maze test",
                                    "Y maze testing",
                                    "Overall"
                                  )
                                ))

mestype_sex <- ggplot(data = ldat, aes(x = yi, y = Measurement.type)) +
  geom_vline(xintercept = 0,
             linetype = 2,
             colour = "black") +
  geom_vline(
    xintercept = res$estimate,
    linetype = 1,
    colour = "red"
  ) +
  geom_errorbarh(
    aes(
      xmin = lower.ci,
      xmax = upper.ci,
      colour = Sex
    ),
    height = 0,
    show.legend = TRUE,
    linewidth = 2,
    position = position_dodge(width = 0.75)
  ) +
  geom_point(
    aes(col = Sex),
    fill = "white",
    size = 1.1,
    shape = 21,
    position = position_dodge2(width = 0.75)
  ) +
  xlim(-3.5, 2) +
  #creating 95% prediction intervals
  geom_segment(data = res,
               ggplot2::aes(
                 x = lowerPR,
                 y = 1,
                 xend = upperPR,
                 yend = 1,
                 group = name
               )) +
  # creating diamonsts (95% CI)
  ggplot2::geom_polygon(data = sum_data,
                        ggplot2::aes(x = x.diamond, y = y.diamond),
                        fill = "red") +
  theme_bw() +
  scale_color_manual(values = colpal_sex) +
  labs(x = "LnRR (Effect size)", y = "", colour = "Sex") +
  theme_segment() +
  theme(plot.margin = margin(
    t = 2,
    r = 6,
    b = 6,
    l = 1
  ))

mestype_sex

# icons

filenames <- list.files(here("icons2", "literature"),
                        pattern = ".png",
                        full.names = TRUE)
ldf <- lapply(filenames, png::readPNG)
names(ldf) <- substr(filenames, 18, 18 + 60)

mestype_sex <- mestype_sex +
  annotation_custom(
    grid::rasterGrob(ldf$Mus_musculus.png),
    xmin = -1.5 * 2.5,
    xmax = -1 * 2.5,
    ymin = 13.5 * 3.5,
    ymax = 14.5 * 3.5
  ) +
  annotation_custom(
    grid::rasterGrob(ldf$Rattus_argentiventer.png),
    xmin = -1 * 2.5,
    xmax = -0.5 * 2.5,
    ymin = 13 * 3.5,
    ymax = 14 * 3.5
  )

mestype_sex
ggsave(
  here("results", "plots", "FigS2_life_healthspan.pdf"),
  width = 90,
  units = "mm",
  height = 165
)

28 R Session Informtion

Code
sessionInfo() %>% pander()

R version 4.4.2 (2024-10-31)

Platform: aarch64-apple-darwin20

locale: en_US.UTF-8||en_US.UTF-8||en_US.UTF-8||C||en_US.UTF-8||en_US.UTF-8

attached base packages: grid, stats, graphics, grDevices, utils, datasets, methods and base

other attached packages: phytools(v.2.4-4), maps(v.3.4.2.1), ggtree(v.3.14.0), ggstance(v.0.3.7), ggimage(v.0.3.3), apextra(v.0.0.0.1), cowplot(v.1.1.3), ggalluvial(v.0.12.5), GoodmanKruskal(v.0.0.3), naniar(v.1.1.0), formatR(v.1.14), here(v.1.0.1), png(v.0.1-8), MuMIn(v.1.48.11), clubSandwich(v.0.6.0), orchaRd(v.2.0), rotl(v.3.1.0), emmeans(v.1.11.0), readxl(v.1.4.5), lme4(v.1.1-37), patchwork(v.1.3.0), kableExtra(v.1.4.0), ape(v.5.8-1), pander(v.0.6.6), metafor(v.4.8-0), numDeriv(v.2016.8-1.1), metadat(v.1.4-0), Matrix(v.1.7-3), lubridate(v.1.9.4), forcats(v.1.0.0), stringr(v.1.5.1), dplyr(v.1.1.4), purrr(v.1.0.4), readr(v.2.1.5), tidyr(v.1.3.1), tibble(v.3.2.1), ggplot2(v.3.5.2) and tidyverse(v.2.0.0)

loaded via a namespace (and not attached): mathjaxr(v.1.6-0), RColorBrewer(v.1.1-3), rstudioapi(v.0.17.1), jsonlite(v.2.0.0), magrittr(v.2.0.3), ggbeeswarm(v.0.7.2), TH.data(v.1.1-3), estimability(v.1.5.1), magick(v.2.8.6), corrplot(v.0.95), farver(v.2.1.2), nloptr(v.2.2.1), rmarkdown(v.2.29), fs(v.1.6.6), vctrs(v.0.6.5), minqa(v.1.2.8), htmltools(v.0.5.8.1), progress(v.1.2.3), DEoptim(v.2.2-8), cellranger(v.1.1.0), gridGraphics(v.0.5-1), htmlwidgets(v.1.6.4), sandwich(v.3.1-1), zoo(v.1.8-14), igraph(v.2.1.4), iterators(v.1.0.14), lifecycle(v.1.0.4), pkgconfig(v.2.0.3), R6(v.2.6.1), fastmap(v.1.2.0), rbibutils(v.2.3), digest(v.0.6.37), aplot(v.0.2.5), rprojroot(v.2.0.4), labeling(v.0.4.3), latex2exp(v.0.9.6), clusterGeneration(v.1.3.8), timechange(v.0.3.0), mgcv(v.1.9-3), httr(v.1.4.7), compiler(v.4.4.2), bit64(v.4.6.0-1), withr(v.3.0.2), doParallel(v.1.0.17), optimParallel(v.1.0-2), MASS(v.7.3-65), scatterplot3d(v.0.3-44), tools(v.4.4.2), vipor(v.0.4.7), rncl(v.0.8.7), beeswarm(v.0.4.0), rentrez(v.1.2.3), visdat(v.0.6.0), quadprog(v.1.5-8), glue(v.1.8.0), nlme(v.3.1-168), generics(v.0.1.3), gtable(v.0.3.6), tzdb(v.0.5.0), hms(v.1.1.3), xml2(v.1.3.8), foreach(v.1.5.2), pillar(v.1.10.2), vroom(v.1.6.5), yulab.utils(v.0.2.0), splines(v.4.4.2), treeio(v.1.30.0), lattice(v.0.22-7), bit(v.4.6.0), survival(v.3.8-3), tidyselect(v.1.2.1), knitr(v.1.50), reformulas(v.0.4.0), svglite(v.2.1.3), stats4(v.4.4.2), xfun(v.0.52), expm(v.1.0-0), stringi(v.1.8.7), lazyeval(v.0.2.2), ggfun(v.0.1.8), yaml(v.2.3.10), pacman(v.0.5.1), boot(v.1.3-31), evaluate(v.1.0.3), codetools(v.0.2-20), ggplotify(v.0.1.2), cli(v.3.6.5), xtable(v.1.8-4), systemfonts(v.1.2.2), Rdpack(v.2.6.4), Rcpp(v.1.0.14), coda(v.0.19-4.1), XML(v.3.99-0.18), parallel(v.4.4.2), prettyunits(v.1.2.0), phangorn(v.2.12.1), viridisLite(v.0.4.2), mvtnorm(v.1.3-3), tidytree(v.0.4.6), scales(v.1.4.0), crayon(v.1.5.3), combinat(v.0.0-8), rlang(v.1.1.6), fastmatch(v.1.1-6), mnormt(v.2.1.1) and multcomp(v.1.4-28)